-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update nzbhydra.service #446
Conversation
Made it that systemd always knows the PID even after restart. You must turn on Shutdown to restart to avoid multiple instances. Known issues: Shutdown from the web will restart, must shutdown from systemd.
Isn't there some way of telling the service manager to not restart the underlying program under certain circumstances, e.g. exit codes? |
I was going to submit that, but I did it by changing the shutdown exit code to 6 but it's unconventional for a successful exit. I had it working perfectly with this method, the issue could be for anyone who is using their own service script it would come up as a failure. |
Well, I could add an option which exit code to use when shutting down... |
Quick and dirty fix changing shutdown exit code to 6 and telling systemd to consider it a success
Change shutdown exit code to 6
Cool. |
If possible I think the shutdown on restart exit code should be 0 |
It is. At least it's supposed to be. |
Sorry, it is currently but with my code change it changes it to 6 as I assume it just calls the regular shutdown, if a new shutdown on restart with exit 0 it should all work, with the current setup shutdown t restart shuts down. edit: newest commit does exactly this |
I've made some assumptions with the code here, but it is working with this change.
Then what's shutdownforrestart() for? |
My previous comment was from uncertainty of how ShutdownForRestart works. A normal shutdown exits with 6 and is defined in systemd as a clean shutdown and told not to restart A restart with ShutdownForRestart enabled exits with 0 systemd restarts the command |
Hm, I don't want to change the default exit code to anything but 0. I could send exit code 0 when shutting down for restart and 6 for regular shutdown but only if "shutdown to restart" is set. That way for regular use exit code 0 is used for successful shutdown and restart is handled by hydra and all is well. When run in a service manager enable "Shutdown for restart" and 0 means restart and 6 means shut down for good. Agreed? |
Agreed, That is definitely ideal, I just couldn't wrap my head around it. |
Made it that systemd always knows the PID even after restart.
You must turn on Shutdown to restart to avoid multiple instances.
Known issues:
Shutdown from the web will restart, must shutdown from systemd.