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 [ExecStart
] -
pre-command
: a command to run before the daemon is started [ExecStartPre
] -
post-command
: a command to run after the daemon is started [ExecStartPost
] -
reload-command
: a command to run to reload the daemon’s configuration (if not specified, the daemon can only restart, not reload) [ExecReload
] -
stop-command
: a command to run to stop the daemon (if not specified, the daemon is killed) [ExecStop
] -
post-stop-command
: a command to run after stopping the daemon [ExecStopPost
] -
restart-delay
: how long to wait after a daemon dies before trying to start it (default 100ms) [RestartSec
] -
start-timeout
: how long after starting the daemon has to notify startup success [TimeoutStartSec
] -
stop-timeout
: how longstop-command
has before the daemon is just killed outright [TimeoutStopSec
] -
restart-condition
: in what situations should the daemon terminating cause it to be restarted [Restart
] -
before
,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. [Before
,After
]
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.