kill -9 + disable messages (standart output) from kill command
- by yael
hi all
I write the following script
this script enable timeout of 20 second if grep not find the relevant string in the
file
the script working well
but the output from the script is like that:
./test: line 11: 30039: Killed
how to disable this message
from the kill command?
how to tell kill command to ignore if process not exist?
THX
Yael
!/bin/ksh
( sleep 20 ; [[ ! -z ps -ef | grep "qsRw -m1" | awk '{print $2}' ]] && kill -9 2/dev/null ps -ef | grep "qsRw -m1" | awk '{print $2}' ; sleep 1 ) &
RESULT=$!
print "the proccess:"$RESULT
grep -qsRw -m1 "monitohhhhhhhr" /var
if [[ $? -ne 0 ]]
then
print "kill "$RESULT
kill -9 $RESULT
fi
print "ENDED"
./test
the proccess:30038
./test: line 11: 30039: Killed
kill 3003