Description
Verification
- This issue's title and/or description do not reference a single formula e.g.
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 with Restart=always
which prevents manually killing the service with systemctl directly. By switching to Restart=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 the brew 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.