Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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