kardianos / service

Run go programs as a service on major platforms.
zlib License
4.45k stars 678 forks source link

systemd on linux - add KillMode, KillSignal and TimeoutStopSec #387

Open avoidik opened 10 months ago

avoidik commented 10 months ago

hello,

with this PR I would like to introduce these new [Service] scoped flags:

addresses:

related PRs:

luoxiaohei commented 4 months ago

@kardianos

I believe this pull request is useful. Could you please take a look at it and consider merging it soon?

Thanks!

kardianos commented 4 months ago

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?

luoxiaohei commented 4 months ago

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:

kardianos commented 4 months ago

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.

avoidik commented 4 months ago

@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