How can l resume a detached screen after switching off my laptop?

I want to launch a program on a remote server (Amazon AWS), but the calculation takes about 50h. So I would like to launch my program, switch off my computer then come back to see the results once finished.

I did the following command:

screen
ssh -i ubuntu@ip-address
python2 my_code.py

and then I pressed Ctrl+A, Ctrl+D to detach.

After that, I switch off my computer. When I switch it on and run

screen -r 

I get the following

There is no screen to be resumed.

1 Answer

If you switched off your laptop, then that screen process has terminated. You should run screen on the AWS instance:

ssh ubuntu@ip
# Then
screen
python ...

Ultimately, screen should run on whichever system is likely to remain running. If that's your laptop, then run screen on the laptop. If that's the AWS instance, then run it on the AWS instance.

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like