The UNIX and Linux Forums  

Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 10-03-2006
srikanthus2002's Avatar
srikanthus2002 srikanthus2002 is offline
Registered User
  
 

Join Date: Sep 2006
Location: Can u guess...!
Posts: 160
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