View Single Post
Posts: 466 | Thanked: 661 times | Joined on Jan 2009
#3
Why kill -9? You should try plain "kill". If the process is responding normally, it should quit gracefully. Only do a "-9" if you intend a "force quit."

There could be something wrong with the more selective grep. You may want to double check that your 'kill' line is even getting executed.
instead of
Code:
kill -9 $i
try:
Code:
echo 'killing '"${i}" >> kill.log && kill "${i}"
to add some logging. If there's nothing in the log, then the grep isn't doing what you want.

Also, be careful with something like "8891*" as this is treated as a regular expression and the "*" is not the same as the "*" in bash, where it's a glob character and not a regular expression meta-character.