Tag Archives: check

checkprocess.sh – Check process & restart

Posted on .

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
  checkprocess.sh (723 bytes, 2,192 hits)

pingstatus.pl — Check for server downtime.


Wanting to continuously check if a server is losing connectivity, I quickly put togethor a small perl script to do the job.

Open the file and edit the variables to determine debug status, email details, server ip etc.

By default it sends a ping every second. If this test fails 5 times in a row, a report is sent via mail.

Disable debug for it to run silently in the background.

pingstatuspl-check-for-server-downtime-image1

Download
  pingstatus.pl (2.4 KiB, 2,461 hits)