I need to run a start-stop-daemon for a redis instance and I want it to send a SIGTERM and if the redis instance doesn't quit i would like it to force a quit.

The start-stop-daemon configuration says that the --retry option can be used for that but i couldn't figure a way to do this, here's my current command:

/sbin/start-stop-daemon --stop --retry forever/TERM --quiet --oknodo --pidfile /var/run/redis/redis.pid --exec /usr/bin/redis-server

Any hints on how I would be able to do this?


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.