Linux shell script to moniter and check service.

Script detail:
This script for check service squid (you can change service if you want).
And restart it if it not running.


#!/bin/sh
SERVICE='squid'
if ps ax | grep -v grep | grep $SERVICE > /dev/null;then
echo "$SERVICE service running, everything is fine"

else
echo "$SERVICE is not running"
/etc/rc.d/init.d/squid restart
/home/admin/script/check_service

###End of Script###

Save with name as you want and run on crontab every 1 min.
.
.

ความคิดเห็น

บทความที่ได้รับความนิยม