Let us take below exampls as a script (urs_script)
4 S srikanth 20075 20074 0 75 0 - 1066 - 15:27 pts/10 00:00:00 usr_script
------------------------------------
Code:
FIND=`ps -elf | grep "usr_script" | grep -v grep`
if [ $? -eq 0 ]
then
echo "process found'
echo $FIND
FINDPROC=`awk {print $4}` # it reads forth column to find process id
kill -9 $FINDPROC # kills process id of the usr_scirpts procsses
else
echo "process no found"
#start your scirpt here
fi
go through this example
if any problem pls let me know to give proper solution