-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
Allow systemctl stop on keep_alive services - Restart=on-failure #17639
Comments
I don't think we should change the default behaviour at this point but I can see an argument for having a different DSL to accomplish what you'd want. CC @SMillerDev for thoughts. |
IIRC there is a different keepalive parameter for this, where it only keeps the service alive on failures. I'm also not that excited about optimising something in |
Well now I'm a bit confused. I went back and looked and found reference to different states under the Formula Cookbook but it looks like other states aren't implemented on a systemd generation? I'm like 99% sure I'm missing something here. I'll try testing it when I have sometime later today. Line 1064 in 07b6b71
I can agree with that. Figured I'd ask as I struggled to think of a use case where always restart makes since on desktop and now that you mention it I can see wanting to avoid management drift. |
It is possible that I never implemented all options for systemd. |
@lethedata Thanks for the link! In that case: yes, this should definitely be implemented. |
Verification
brew install wget
. If they do, open an issue at https://github.com/Homebrew/homebrew-core/issues/new/choose instead.Provide a detailed description of the proposed feature
When brew generates a systemd unit file with
keep_alive true
in the formula, it generates withRestart=always
which prevents manually killing the service with systemctl directly. By switching toRestart=on-failure
Linux users will be able to kill services with systemctl while still retaining a proper keep-alive functionality1. This would also limit the need for brew to handle generating multiple exit codes (I think it was done this way due to a limitation on the MacOS side).I think this change only requires a single line be changed in the service.rb file but I'm not familiar enough the code to be sure.
brew/Library/Homebrew/service.rb
Line 475 in 8c4c731
What is the motivation for the feature?
Being unable to kill a service with
systemctl
as a workaround to thebrew services kill
keep-alive limitation. The service only needed to be temporarily killed, not completely disabled, and being unable to manually kill it seemed a bit odd.How will the feature be relevant to at least 90% of Homebrew users?
It will allow Linux users manually kill services with
systemctl stop --user homebrew.SERVICENAME.service
without needing to fully disable the service.What alternatives to the feature have been considered?
I wasn't able to find any previous discussion but but an alternative would be to have brew handle multiple exit states within the keep-alive but I think this would diverge the Linux and MacOS side requiring quite a bit of change.
Footnotes
systemd.service manual ↩
The text was updated successfully, but these errors were encountered: