Quantcast
Channel: check – nooblet.org
Viewing all articles
Browse latest Browse all 2

checkprocess.sh – Check process & restart

$
0
0

I have a process that has been crashing every few days, but needs to be running 24/7 to be effective. Until I find the time to seek out the cause, I need the process to be restarted.

This short SH script uses PS to check that the process is running, and if not, runs the given init-script to restart the service.

Syntax:

checkprocess.sh [process] [init-script]

Example:

checkprocess.sh myprocess /etc/init.d/myprocess

checkprocess.sh writes a log at /var/log/checkprocess.log, and sends an alert mail to root should the process require restarting.

Put the checkprocess.sh command into crontab to check regular for the crashed process. For debian the crontab entry would look similar to:
*/1 * * * * root /usr/local/bin/checkprocess.sh mythbackend /etc/init.d/myth-backend

Download
Note: There is a file embedded within this post, please visit this post to download the file.


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images