Next Previous Contents

2. Unix/Linux command - procautostart

Use the program procautostart (say "Prok-Auto-Start" or Process AutoStart) to monitor and automatically re-start any Unix/Linux process if they die. The program listing is given in following sections in this document.

procautostart -n < delay_seconds > -c "< command_line >" nohup &

This starts the unix process procautostart and also command_line process. The procautostart process will re-start command_line process if it dies. The -n option is the time delay in seconds before procautostart checks the running process started by command_line. It is advisable to start the procautostart as background process with no-hangup using "nohup &". See 'man nohup'.

The procautostart is written in "C" so that it is very fast and efficient, since the program is called every n seconds. Amount of resources consumed by procautostart is very minute.

For example -


        procautostart -n 12 -c "monitor_test -d $HOME  -a dummy_arg " nohup &

Here procautostart will be checking the process monitor_test every 12 seconds.

The program will output log files in 'mon' sub-directory which has datetime stamp of when the processes died and re-started. These files gives info on how often the processes are dying.

You can also use micro-seconds option '-m' or nano-seconds option '-o', edit the source code file procautostart.cpp and uncomment appropriate lines.


Next Previous Contents