How can I generate a command for start-stop-daemon that will kill the process if it doesn't term during a timeout period?
Solution 1:
There are two ways:
The first is just to specify a numeric --retry
value. Then it will use /signal/timeout/KILL/timeout
schedule. I.e. send a terminating signal (specified with --signal
option), then wait the specified number of seconds and then send a KILL signal that could not be ignored by a process and therefore it will be forced to exit.
The command will look like:
/sbin/start-stop-daemon --stop --signal TERM --retry 5 --quiet --oknodo --pidfile /var/run/redis/redis.pid --exec /usr/bin/redis-server
The second is to specify a complete schedule to the --retry option
. It will look like:
/sbin/start-stop-daemon --stop --retry TERM/5/KILL/10 --quiet --oknodo --pidfile /var/run/redis/redis.pid --exec /usr/bin/redis-server