Results 1 to 2 of 2
Hello
A friend of mine runs a Debian host and uses CRON to start a PHP script regularly to download the weather for his location, but sometimes, the script goes ...
- 03-14-2008 #1Linux Newbie
- Join Date
- Nov 2007
- Posts
- 127
Greping ps to kill rogue process?
Hello
A friend of mine runs a Debian host and uses CRON to start a PHP script regularly to download the weather for his location, but sometimes, the script goes haywire, so he'd like to run a CRON job to grep through ps, and kill this program if it's been running for eg. 20mn.
I know that the real solution is to find out why the PHP script goes crazy in the first place, but he needs this ASAP.
Anybody knows what SH/BASH commands to include in a script to do this?
Thank you.
- 03-14-2008 #2Linux Newbie
- Join Date
- Nov 2007
- Posts
- 127
I think I found it:
killall -9 myscript.phpcli
Otherwise, there this:
kill -9 `ps ax | grep myscript.phpcli | grep -v grep | awk '{print $1}'`


Reply With Quote