I have a python script I want to keep running for most of a day. I have tried the following;
-- Screen. I SSH to the Raspberry Pi,and they type "screen bash", I then start my script and then "control-shift-a b" to detach from screen.
At this point I can logout of SSH, log back in, do a screen -r and reconnect to my "screen session" and the script is still runnning; perfect!
But, I leave my Mac for a while, and the corporate-mandated sleep kicks in, when I return, and reconnect to the raspberry-pi over SSH, a "screen -list" no longer shows any detached session to reconnect to.
I think the raspberry pi must be cleaning up after some period of time.
-- I also tried preventing SSH timeouts on the Pi, with "ServerAliveInterval 120" but again, when the Mac goes to sleep, the SSH session still gets killed, and the detached screen is no longer on the Pi when I reconnect.
Can anyone help me figure out how to keep my script running on the Pi even after my SSH session is timed out/gone?
EDIT:: Thanks for the responses, I have dabbled with nohup and I think tmux is an alternative to screen, but I don't believe either of these work for my situation.
I think the root problem is that anything I do to keep the script or execution envoronment running is "cleaned up" by some Pi process when my SSH session times out.
Is there anything I can do to keep screen, or tmux or nohup running when my SSH session times out?