Running remote jobs after disconnecting

screen

When running long jobs remotely (file transfer, heavy computational jobs, etc), it's sometimes helpful to be able to start the job and disconnect from the remote system (while the jobs continues to run).

screen is one tool that can be used to acomplish this. The usual procedure is to connect to the remote system, start a screen session, start the job, disconnect from the screen session, and log-out.

start session | screen

disconnect from session | <ctrl-a d> (control a + "d")

re-connect to existing session | screen -r

check for existing sessions | screen -ls

quit screen session | exit

example screen file transfer

localsys> ssh [meyer@crystal.harvard.edu](mailto:meyer@crystal.harvard.edu)

connect to remote system

crystal> screen # start screen session

crystal> scp -r -p meyer@remote_site:~/data/ ~/data/ # start data transfer

crystal> <ctrl-a d> # disconnect from screen session

crystal> logout # disconnect from remote system

localsys> # all done

example screen computational job

localsys> ssh [meyer@crystal.harvard.edu](mailto:meyer@crystal.harvard.edu)

connect to remote gateway system

crystal> ssh abacus # connect to your workstation; replace abacus with the name of your workstation

abacus> screen # start screen session

abacus> ./data_processing_script.sh # start processing data

abacus> <ctrl-a d> # disconnect from screen session

abacus> logout # disconnect from workstation

crystal> logout # disconnect from gateway system

localsys> # all done

For more information, see the screen manual.