Question

nginx service stopped after exiting the server throws (code=exited, status=147)

Services exited with the below code.

Service file:

[Unit]
Description=Sample services

[Service]
WorkingDirectory=/var/www/services
ExecStart=/usr/bin/dotnet /var/www/services/Sample.dll
Restart=always
RestartSec=10
KillSignal=SIGINT
SyslogIdentifier=services
User=www-data
Environment=ASPNETCORE_ENVIRONMENT=Production
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false

[Install]
WantedBy=multi-user.target

Running sudo systemctl status services.service shows below issue with code exited and status as 147:

 services.service - Sample services
     Loaded: loaded (/etc/systemd/system/services.service; enabled; vendor preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Wed 2021-05-05 12:00:59 UTC; 172ms ago
    Process: 288358 ExecStart=/usr/bin/dotnet /var/www/services/Sample.dll (code=exited, status=147)
   Main PID: 288358 (code=exited, status=147)

May 05 12:00:59 ubuntu-s-1vcpu-1gb-nyc3-01 systemd[1]: services.service: Main process exited, code=exited, status=147/n/a
May 05 12:00:59 ubuntu-s-1vcpu-1gb-nyc3-01 systemd[1]: services.service: Failed with result 'exit-code'.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi @thirukumaranmurugan,

In cases such as this, I always suggest checking out you error_logs. If that doesn’t help you can always try to restart the service

systemctl restart ServiceName

and immediately after that follow the journal just as @bobbyiliev suggested:

journalctl -xe

This is just because (code=exited, status=147) is a very generic error and you’ll see a more descriptive error in either the error log or in the journal. Once you know the exact error you can act upon them

Hi there,

Does the service run as expected if you run it with /usr/bin/dotnet /var/www/services/Sample.dll directly?

I could also suggest running the following command and checking for some more errors there:

journalctl -xe

Feel free to share the errors here.

Regards, Bobby