#FILE NAME: pkill
#Killing processes by command string
#!/bin/sh
HOSTTYPE=`uname -s`
SIGNAL=$1
STRING=$2
if [ -z "$1" -o -z "$2" ]
then
echo Usage: $0 signal string eg: pkill -9 frmweb
exit 1
fi
case $HOSTTYPE in
Darwin|BSD)
ps -a -opid,command | grep $STRING | awk '{ print $1; }' | xargs kill $SIGNAL
;;
Linux|Solaris|AIX|HP-UX)
ps -e -opid,command | grep $STRING | awk '{ print $1; }' | xargs kill $SIGNAL
;;
esac
#Killing processes by command string
#!/bin/sh
HOSTTYPE=`uname -s`
SIGNAL=$1
STRING=$2
if [ -z "$1" -o -z "$2" ]
then
echo Usage: $0 signal string eg: pkill -9 frmweb
exit 1
fi
case $HOSTTYPE in
Darwin|BSD)
ps -a -opid,command | grep $STRING | awk '{ print $1; }' | xargs kill $SIGNAL
;;
Linux|Solaris|AIX|HP-UX)
ps -e -opid,command | grep $STRING | awk '{ print $1; }' | xargs kill $SIGNAL
;;
esac
1 comment:
Post a Comment