Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running a service under daemontools that take several seconds to stop when sent the TERM signal. I need to stop it in a script, and then wait for the process to stop before continuing to take a LVM snapshot or restarting the service.

Does daemontools provide a way to do this? If not, what's the best way? I was thinking of sleeping while svcok exits with 0, but it seems like this should be a common problem with an easier solution. Thoughts?

share|improve this question

A way to do that I already used is to take the problem differently, in your run script you can do anything you want before running your application so you could do this:


# backup anything you want
rsync xxxx

exec /path/to/app

and then:

svc -du /path/to/service

would stop the application and when stopped, take your backup and then restart it.

While it is not completely what you asked it serves the same goal and works well :)

share|improve this answer

Your Answer


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.