Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to know if a running script dies?

So I'm somewhat new to programming and mostly self-taught, so sorry if this question is a bit on the novice side.

I have a python script that runs over long periods (e.g. it downloads pages every few seconds for days at a time.) Sort of a monitoring script for a web app.

Every so often, something will disrupt it, and it'll need restarted. I've gotten these events to a bare minimum but it still happens every few days, and when it does get killed it could be bad news if I don't notice for a few hours.

Right now it's running in a screen session on a VPS.

Could someone point me in the right direction as far as knowing when the script dies / and having it automatically restart?

Would this be something to write in Bash? Or something else? I've never done anything like it before and don't know where to start or even look for information.

like image 387
some1 Avatar asked Dec 12 '22 05:12

some1


1 Answers

You could try supervisord, it's a tool for controlling daemon processes.

like image 53
radu.ciorba Avatar answered Dec 20 '22 20:12

radu.ciorba