Open avoidik opened 10 months ago
@kardianos
I believe this pull request is useful. Could you please take a look at it and consider merging it soon?
Thanks!
Can you doc the new specific flags? Will changing these, such as Kill mode, etc, alter how the service, by default works? What values should it expect?
Hi @kardianos,
Thank you for your feedback. Just to confirm, are you requesting that detailed documentation be added to the pull request, such as annotations and descriptions for the new options? Or are you expecting the definition of some global variables to declare the available values and default values for each option?
To provide some context, here are brief explanations of these flags, along with their default values and expected ranges:
KillMode: Determines how processes of a service should be killed when the service is stopped.
control-group
control-group
: All processes in the control group are killed.process
: Only the main process is killed.mixed
: Main process is killed with KillSignal, and remaining processes are killed with SIGKILL.none
: No processes are killed.KillSignal: Specifies which signal should be sent to the service's main process when it is being stopped.
SIGTERM
SIGTERM
, SIGKILL
, SIGINT
, SIGHUP
, etc.TimeoutStopSec: Sets the time to wait for a service to stop after sending the termination signal before forcibly killing it.
90 seconds
30s
(30 seconds), 5min
(5 minutes), 1h
(1 hour), etc.On on the fence on Timeout Stop Sec.
The Kill signal, that would probably interfere with the current implementation of func (s *systemd) Run() (err error) {
The KillMode
, I'm not sure when you wouldn't want to have control-group, for a multi-platform service system.
Where is this need coming from? More broadly, I would be inclined to make separate system packages that have many options, such as systemd, then have service package be a generic package, with perhaps a system specific use cases. If you know you are going to use systemd, maybe just use it directly.
@kardianos it's quite good summary, I understand your desire to keep this package simple and as generic as possible, without implementing edge-case logic specific to downstream solutions, alternatively, you have left an option to be able to render our own custom template for units, in case of systemd it's called "SystemdScript", if we absolutely sure we'd want to use systemd this option is what we need, however this part hasn't been described in details
hello,
with this PR I would like to introduce these new
[Service]
scoped flags:KillMode
KillSignal
TimeoutStopSec
addresses:
related PRs: