#!/bin/bash ############################################################## #Matthew Russell 11 Feb 04 #killRefreshDaemon.scr ############################################################## #Kill a process by getting its id in Terminal. #Step 1: Use "ps -aux" to get a list of all processes #Step 2: Pipe to grep and search for IPRefreshDaemon.scr #Step 3: Pipe to awk to get the second column--the id. # Store this process id. #Step 4: send the kill command to this process # #More extensive error checking can be done if you want. #For example, you might check to see that process_id actually #contains a number before killing it, and then after the kill #command, make sure that the process actually died. ############################################################## process_id=`ps -aux | grep "IPRefreshDaemon\.scr" | awk '{print $2}'` #echo $process_id kill -9 $process_id