I was making a crontab script for a customer today when I got the inspiration to finally do what I have been wanting to do for a while. I wrote a script to write the script for me. This handy script reads in 4 parameters:

  1. The working directory (where to cd to)
  2. A binary file (or command to run)
  3. A file containing the PID of the process to restart
  4. An output file to save the script to.

This generates a script that can be run from anywhere, like the crontab which will check to make sure the process is running. It will restart the process if not by running the binary file parameter.

The generated script is based on the Unreal3.2 ircdchk script, with some slight modifications. I hope someone finds it useful… if you do, drop a comment here.

Leave a Reply

Your email address will not be published. Required fields are marked *