amuck-landowner

Retry in 30 seconds

NodeBytes

Dedi Addict
Hey y'all how would you get a Python script to restart itself in 30 seconds? I don't need it to be a cron job, just if it fails to do something then wait 30 seconds and re-run the script.
 

Virtovo

New Member
Verified Provider
Hey y'all how would you get a Python script to restart itself in 30 seconds? I don't need it to be a cron job, just if it fails to do something then wait 30 seconds and re-run the script.
I guess it depends and how and why it is failing.  Can you not simply handle it in a try/except within the code?  
 

NodeBytes

Dedi Addict
I just realized I can't do what I was trying to do... for other reasons. Basically if I can't connect to the internet the script kills itself as is and I need it not to do that. But this problem is fixed. :)

Thanks for your help!
 

Virtovo

New Member
Verified Provider
I just realized I can't do what I was trying to do... for other reasons. Basically if I can't connect to the internet the script kills itself as is and I need it not to do that. But this problem is fixed. :)

Thanks for your help!
Glad you got it resolved.  Not sure what your implementation is like; however if you're having issues with connections timing it out put them in separate threads/processes using either threading or multiprocessing modules.
 

NodeBytes

Dedi Addict
Glad you got it resolved.  Not sure what your implementation is like; however if you're having issues with connections timing it out put them in separate threads/processes using either threading or multiprocessing modules.
This script basically emails me the ip address of my raspberry pi every time it reboots. It's so I can plug it in while I am out and ssh into it. It has it's own 4g dongle for internet.
 

BuyCPanel-Kevin

New Member
Verified Provider
start a new thread in a while true loop in the main every 30 seconds, that is if you thought you could accomplish what ever you were trying to do
 
Last edited by a moderator:

Virtovo

New Member
Verified Provider
This script basically emails me the ip address of my raspberry pi every time it reboots. It's so I can plug it in while I am out and ssh into it. It has it's own 4g dongle for internet.
If you've still got problems, happy to look at the code or knock something up myself.  Just let me know!
 

Shados

Professional Snake Miner
This script basically emails me the ip address of my raspberry pi every time it reboots. It's so I can plug it in while I am out and ssh into it. It has it's own 4g dongle for internet.
Why not just use an existing dynamic dns service?
 
Top
amuck-landowner