Shell script and ps aux
Posted: Mon Jan 16, 2006 9:17 am
Hello together,
Using screen (http://nerdierthanthou.nfshost.com/2004 ... howto.html) I start several PHP scripts in different screens, which run endlessly.
Sometimes a script crashes. Such scripts should automatically be restarted.
One can check if a specific script is still running, by using 'ps -aux' , displaying running process. If the script is not running anymore, the shell script sould restart the script automatically. How can I check if a specific script is still running and if not, restart the script with /opt/lampp/bin/php my_script.php?
Since I'm a newbie in shell scripting, I would appreciate any helpful, practical suggestions and examples. I don't know where to start off...
Thanks,
visionmaster
Using screen (http://nerdierthanthou.nfshost.com/2004 ... howto.html) I start several PHP scripts in different screens, which run endlessly.
Sometimes a script crashes. Such scripts should automatically be restarted.
One can check if a specific script is still running, by using 'ps -aux' , displaying running process. If the script is not running anymore, the shell script sould restart the script automatically. How can I check if a specific script is still running and if not, restart the script with /opt/lampp/bin/php my_script.php?
Since I'm a newbie in shell scripting, I would appreciate any helpful, practical suggestions and examples. I don't know where to start off...
Thanks,
visionmaster