There are many ways to keep a process running on linux but I haven't seen any that are as easy to implement as the script below.
Basically the script does a
and then a
for your process. If it's not running it will re-start the process.
You install the script into your crontab i.e.
As a bonus this mechanism will re-start your process after a re-boot.
Cut and paste the following code into your crontab.
*/5 * * * * /home/path_to_the_script/make-run.sh
Make sure the cron entry is pointing to where your make-run.sh is located.
#!/bin/bash # make-run.sh # make sure a process is always running. # Add the following to the crontab (i.e. crontab -e) # */5 * * * * /home/path_to_make_run/make-run.sh process=servermonitoringhq makerun="/home/path_to_the_job_you_want_running/runjob.sh" if ps ax | grep -v grep | grep $process > /dev/null then exit else $makerun & fi
Test the script on it's own first to make sure it starts your job.
Spot server issues in lightning time with no software to install.
"It's like PingDom for servers"