I'm trying to run my dotnet application as a daemon service, the first steps that I did are:

Created the application using NetCore 2.0
Build the binary using dotnet publish swp

inside Ubuntu terminal I created an user for run the daemon:

sudo useradd -s /sbin/nologin dotnetuser
sudo mkdir /var/swp
sudo cp -R /home/publish/* /var/swp
sudo chown -R dotnetuser:dotnetuser /var/swp

so I created a custom systemd unit file under: /etc/systemd/system/netcore-console-swp.service directory:

Description= Scraper SWP
DefaultDependencies = no

Type = oneshot
RemainAfterExit = no
ExecStart= /var/bot/ swp.dll
WorkingDirectory = /var/swp
User = dotnetuser
Group = dotnetuser


I tried to execute the daemon using the systemctl status command: start netcore-console-swp.service

but I got:

netcoreconsole-swp.service: Main process exited, code=exit

if I execute the app as dotnet bot.dll this working, what is wrong in my configuration?

What I did wrong?

  • /var/bot/ swp.dll this very different from what you've typed in your terminal no ? – Kiwy May 22 '18 at 14:41
  • sorry was a typo error, I tried different name, anyway the problem is the same – utop May 22 '18 at 15:00
  • How do you know it didn't work? It's normal for "oneshot" services to run and then exit. Add logging to your app so you can cofirm where it exited. – Mark Stosberg May 22 '18 at 17:15
  • Please fix your question to show what actually was in your ExecStart setting, then. – JdeBP May 22 '18 at 17:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.