Restarting a daemon

J

Jeffrey Barish

Not exactly a Python question, but I thought I would start here.

I have a server that runs as a daemon. I can restart the server manually
with the command

myserver restart

This command starts a new myserver which first looks up the pid for the one
that is running and sends it a terminate signal. The new one then
daemonizes itself.

I want the server to be able to restart itself. Will it work to have
myserver issue "myserver restart" using os.system? I fear that the new
myserver, which will be running in a subshell, will terminate the subshell
along with the old myserver when it sends the terminate signal to the old
myserver. If so, what is the correct way to restart the daemon? Will it
work to run the restart command in a subprocess rather than a subshell or
will a subprocess also terminate when its parent terminates?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top