Thursday, November 30, 2006

Simple Script to check if a process is running and if not restart it

I wrote this simple script to check if a process is running and if not restart it



#!/bin/sh
TEST=`pgrep $1`
if [ ! "$TEST" ]
then
$2
else
echo "$1 Alive "
fi
Usage:
check.sh
Example:
check.sh named /usr/local/sbin/named

No comments:

Post a Comment