megarry
asked on
Shell script tp kill a process
I have a php script that I'm runnign via cron. Sometimes it exits when finished and sometimes it hangs.. I have no idea why, it runs and exits via a sheel and runs then exits thru Zend Studio using my server as to debug.
The script goes out and index's anythign new on youtube in certain categories. How can I insure the php script die's before the next cron job starts? Is there a way to do this in a php or a shell script? I have 3 php files that run, one per hour.. all three have the eextension _auto.php
I'd like to search running processes and if _auto.php is found, killl the process.. I don't know enough about shell scripts to do that and my googl searches have come up empty. Or is it better to let the php script first check for another copy running and kill it if it is?
The script goes out and index's anythign new on youtube in certain categories. How can I insure the php script die's before the next cron job starts? Is there a way to do this in a php or a shell script? I have 3 php files that run, one per hour.. all three have the eextension _auto.php
I'd like to search running processes and if _auto.php is found, killl the process.. I don't know enough about shell scripts to do that and my googl searches have come up empty. Or is it better to let the php script first check for another copy running and kill it if it is?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I liked the PHP one best because I can include this in my app and as you said, not have to cycle thru the process list.
kill -9 `ps -ef | grep _auto.php | awk '{ print $2 }'`