In reading Expose systemd’s RestartSec?, we looked at the systemd service directives subset that we expose, and realise that perhaps the policy so far of adding things on request has resulted in a bit of a mess.
So, let’s fix that. How about, when something is a daemon, you can specify [and the systemd directive to which it roughly maps]:
command: this is the daemon itself, as now [
pre-command: a command to run before the daemon is started [
post-command: a command to run after the daemon is started [
reload-command: a command to run to reload the daemon’s configuration (if not specified, the daemon can only restart, not reload) [
stop-command: a command to run to stop the daemon (if not specified, the daemon is killed) [
post-stop-command: a command to run after stopping the daemon [
restart-delay: how long to wait after a daemon dies before trying to start it (default 100ms) [
start-timeout: how long after starting the daemon has to notify startup success [
stop-timeout: how long
stop-commandhas before the daemon is just killed outright [
restart-condition: in what situations should the daemon terminating cause it to be restarted [
after: order this daemon before/after the other daemons (if the other daemon is run at all). Can only refer to daemons in the same snap; this is a list of names. [
We would continue to not support multiple commands in each of the
command options (so you could only have at most one
pre-command per app).
Anything else you’d like? Speak now, or … or speak later, but now would be nicer.