This is not a happy situation to begin with, but what if you have to? Someone has to do the dirty job. In order for you to not have your laptop connected to the production environment for 10 hours just to run a job, you need:
Steps
So, for our specific purpose, to keep it short:
- Enter
screento enter the screen. - Do the long-running dirty job that you need to do.
- Close the ssh. This will force your job to go into “detached” mode. Aka, it’s running in the background now. Don’t use
exitto close it, though, or you’ll close yourscreen, and by extension, end your job. - After 10 hours, ssh back into production, and use
screen -lsto list all the screens that are in the background. - Use
screen -r 41565(number will be listed after running the above command) to enter the hidden screen. - Use
exitto endscreen.
Alternatively
- If you don’t like numbers, you can also give your
screena name withscreen -S fancy-nameand use this name to re-attach back to it. - If you are confused about all the “closing” of windows, you can also explicitly detach your
screenwithctrl + Athen pressd.
