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'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

1 Answer 1

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:

#!/bin/sh

# 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

 
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.