How do you restart the Python script automatically if it is killed or dies?
Answer
Have your cron look for your script and relaunch it if it dies.
Answer
Have your cron look for your script and relaunch it if it dies.
- Create a new crontab by running crontab -e . This will bring up a window of your favorite text editor.
- Add this line to the file that just opened */5 * * * * pgrep -f testing.py || nohup python /home/you/scripts/testing. py > test. out.