Script to kill process...

hello Bros,

I need to write some script that i can put it on crontab which checks for a process X if running. If the process X is ruuning then take the PID and kill it or display message that says process X is not running.

I am using AIX 5.3

Thanks guys.:b:

you can get the PID of the process by

 
PID=`ps -ef|awk '/processname/&&!/awk/{print $2}'`
if [ -z $PID ] ; then
echo "PROCESS IS NOT RUNNING"
else
kill -9 $PID
wall "YOUR MESSAGE"
fi

Thanks..working fine.