Skip to content
Nikolay Markov edited this page Apr 3, 2021 · 1 revision

Using screen utility on quest

screen is very valuable: it allows you to launch a long-running job in the terminal on quest, detach from it and let it run in the background, while you close your computer or launch other commands.

basic usage:

  1. screen will launch a new terminal session
  2. start your long-running script
  3. type Ctrl-a followed by Ctrl-d to detach from the session and return back to the original terminal
  4. screen -ls will tell you which screen sessions are running
  5. screen -r or screen -r <session> will restore you to a given session
  6. exit or Ctrl-d will close a session when you're done

more info on screen could be found here: https://linuxhandbook.com/screen-command/

quest specifics:
screen session is bound to the login node from which you start it. When you connect to quest, you end up on 1 of the 4 login nodes at random. They are called quser21, quser22, quser23 and quser24. To restore a specific screen session, you need to connect to the login node where this session is. You can connect to any node from any node by typing ssh <node>, for example ssh quser23

to survey which sessions you have across all the login nodes, you can use a small script:

  1. add ~/bin to your path: hb="$HOME/bin"; if [[ "$PATH" != *"$hb"* ]]; then echo -e "\n\n# adding home bin to \$PATH\nexport PATH=\"\$PATH:$hb\"\n" >> ~/.bashrc; . ~/.bashrc; fi
  2. install the script: mkdir -p ~/bin && wget "https://raw.githubusercontent.com/NUPulmonary/utils/master/bash/screen-status" -O ~/bin/screen-status && chmod +x ~/bin/screen-status
  3. use it: screen-status
  4. example output:
$ screen-status
quser21
There are screens on:
	10620.sn-ct-ipf-covid	(Detached)
	4322.hohoho	(Detached)
quser24
There are screens on:
	6262.serious-scripts	(Detached)
	4421.pts-226.quser24	(Detached)
Clone this wiki locally