#!/usr/bin/perl -w $PID=`cat /export/home/weblogic/bai/bpps.sh.pid`; print "Checking\n"; check_for_bpps(); sub check_for_bpps { $PS=`ps -eaf | grep $PID`; if ($PS =~ /bpps/) { print "output from ps is: $PS\n"; } else { print "Stopping process and restarting process\n"; exec(`sh -c /export/home/weblogic/bai/bpps.sh stop;sh -c /export/home/weblogic/bai/bpps.sh start 2 > /dev/null 2>&1`); } }