Hack Forums
Keep and access a python file once logged out? - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Computing (https://hackforums.net/forumdisplay.php?fid=88)
+---- Forum: Linux (https://hackforums.net/forumdisplay.php?fid=85)
+---- Thread: Keep and access a python file once logged out? (/showthread.php?tid=5668215)



Keep and access a python file once logged out? - PGTips - Jul 12, 2017

I want my python script to keep running even after I log out of my SSH session.

Then when I log back in, I can go back into the script where it currently is.

(I need to type commands and when I log out my script just closes all the connected connections).


* - Marxist - Jul 13, 2017

Spoiler (Click to View)


edit:
If none of this works try. I may have mis-read some o the documentation of the above examples.
Code
nohup python examplescript.py  > /var/log/python/examplescript.log 2>&1 &
And to check the output run
tail /var/log/python/examplescript.log


* - g4143 - Jul 13, 2017

(Jul 12, 2017 04:24 PM)PGTips Wrote:  I want my python script to keep running even after I log out of my SSH session.

Then when I log back in, I can go back into the script where it currently is.

(I need to type commands and when I log out my script just closes all the connected connections).

What kind of permissions do you have when you log in?


* - Cannot Compute - Jul 13, 2017

Try using something like screen, that way it should be able to stay alive when you close your connection.