I run python script from cron every hour on CentOS 5 and see some processes keep running for a few hours I would like to run a script every few hours to kill those processes. How can I write the script that terminate the process?
1 Answer
No need to build a watcher script, check the timeout command.
timeout 2h your_python_script
This command will kill your_python_script if it's still running after 2 hours.