[cod] Restart script

Ryan C. Gordon icculus at icculus.org
Thu Nov 29 02:38:22 EST 2007


> Ryan:  My wishlist for something like this in the following order, in terms
> of commandline switches:
> 1.  --pidfile= (to specify where to record the pid of the process)
> 2.  --daemonize (to close file handles, drop controlling tty, and get 
> adopted by pid1)
> 3.  --user=  (to drop privs to a specific user if executed by uid 0, after
> pidfile has been written)
> 
> Any of the above in the next binary would bring tears of joy from me.

Write something small that exec()'s the process, so you keep the same 
pid, but can drop privs, write a pid file, and close stdin/stdout/stderr 
before launching.

It shouldn't take any changes to cod4 to accomplish this.

--ryan.





More information about the Cod mailing list