0

I have a python script using websocket. After few hours my websocket connection is sometimes lost and I am not able to capture the disconnection.

I would like my ssh machine reboots every 12 hours and starts again my python script.

Is it the best way to process? How can I do it on a ssh machine?

Can I use

0 */12 * * * sudo reboot

and after automatically start my python script?

6
  • Not sure if it is the best way to do it, but you could temporarily put it /etc/init.d as a startup script (don't forget to make it executable) chmod +x /etc/init.d/start_python_script.sh. Commented May 10, 2021 at 12:19
  • Oh, looks like my last post is a bit out of date... looks like one shouldn't do it that way anymore... stackoverflow.com/questions/51025312/… Commented May 10, 2021 at 12:26
  • Thank you, why It shouldn't be done anymore? Commented May 10, 2021 at 12:39
  • Tbh, it still works afaik but perhaps people want to encourage others to move to the newer systems approach! Commented May 10, 2021 at 12:42
  • ok I understand thank you Commented May 10, 2021 at 12:51

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.