Let's say I have this python script on my VPS:
# test.py
import time
while True: print('tick...') time.sleep(10)If I log into my VPS using SSH and run this script, I can see tick... messages appearing in the console. But if I log out and log in again, everything is gone. I can see using htop that the python script is still running, just not printing anything into my new SSH session.
Is there any way I can recover the last SSH session, so I can see the results of my script again?
I tried the screen tool (screen -S test -> python test.py), but after re-connecting to SSH, when I try to go to my screen session (screen - S test) it only prints [screen is terminating].
1 Answer
The command screen - S test is incorrect. If you want to re-attach to your detached screen session called "test", you should use the command
screen -R test 1