#!/bin/sh
#
# Use pgrep to look for a process.  For use with Nagios
#
# 8/18/2003, tbaxter
#

if [ $# -ne 1 ]; then
    echo "ERROR:  No process given"
    exit 1
fi

process=$1

pid=`pgrep -x $process`

if [ $? -eq 0 ]; then
    echo "$process OK running with PID $pid"
    exit 0
else
    echo "$process is not running"
    exit 2
fi
