2

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?

1 Answer 1

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 :)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .