How to keep a job running in Linux Rumi, November 13, 2017November 13, 2017 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 ps ax and then a grep for your process. If it’s not running it will re-start the process. You install the script into your crontab i.e. crontab -e As a bonus this mechanism will re-start your process after a re-boot. Edit your crontab 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. The Bash script #!/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. Related Scripts BashCronShell
A good Webmail with least complications and have beautiful interface- MailBee July 7, 2008July 7, 2008 I was just tired on working webmail projects with- Horde Neomail Squirrelmail (I did customize quite a long back!) DWMail Uebimiau MDaemon with IIS integration And so many!!!!! Anyway, my eyes were bored in seeing those interfaces on and on, just looked for some new thingy available now a days…… Read More
Linux service restart shell script June 6, 2014 I badly needed a script that would check if my running services (in this script it'll check varnish and apache2 services) are alive- if not, it'll restart the dead service and write a log. Pretty handy! #!/bin/sh STARTAPACHE="/etc/init.d/apache2 start" STARTVARNISH="/etc/init.d/varnish start" Related Read More
URL Redirect PHP script for Horde October 12, 2008November 6, 2008 I nearly got mad implementing horde in virtualmin. Though this section will not tell how the Horde was setup. Anyways, HORDE needs to work under /horde framework. I know this can be fixed up in registry.php file and can be used as /groupware or something. Related Read More