[Toolserver-l] making sure your bots are always running: introducing phoenix

Daniel Kinzler daniel at brightbyte.de
Fri Oct 17 21:26:05 UTC 2008


Hi all

We have all seen the problem that some script or bot we have come to rely upon
suddenly dies. Or fails to restart when the toolserver is rebooted. Putting
something into cron to be run on @reboot sadly doesn't always work, for example
because the home directory may not yet be mounted when cron runs reboot jobs.

So, after a short discussion on IRC, i wrote a script to take care of this. I
called if phoenix, it's available in the system path on nightshade and hemlock.

Phonix just starts whatever command you give to it, but it first checks if that
command is already running. If it is already running, phoenix does nothing. So,
just call phonix from cron every few minutes to make sure your bot is restarted
when it dies.

For example, if you want to run 'mybot', call this every few minutes from cron:

  phoenix /tmp/yourname-mybot /home/mydir/bin/mybot someparam

The path /tmp/yourname-mybot is the base fir the PID and output files - output
fill be written to /tmp/yourname-mybot.out, the processes pid will be stored in
/tmp/yourname-mybot.pid.

The second parameter, /home/mydir/bin/mybot, is the program to run. Anything
following that are parameters to pass to this program.


Please try it out and tell me about any problems! phoenix also prints a short
help message when called without any parameters.

-- daniel

PS: I'm sure this wheel has been invented before... any pointers?



More information about the Toolserver-l mailing list