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

| No Comments

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

Leave a comment