Forums

Possible to Automatically stop/kill bash console?

I have a script which I have tried to control for the exceptions but still have issues. My script collects data and writes it to my MySQL database on pythonanywhere.com. Is there any way to setup the automatic run for every hour to simply run myscript.py file and kill the previous console so I am not attempting to write to the database twice? I also don't want to waste computing power by duplicating the same task.

Use a scheduled task. There is documentation on the help site.

glenn,

I am using a scheduled task. However, I need to "kill" the previous task (which will be the same script running every hour)

hmm. Can you just get the second task to stop if the first task is still running?

how would I check that? how would I reference it?

https://help.pythonanywhere.com/pages/LongRunningTasks