HOME ESR EXPERIMENTS LABS etc
NucAR lab laser_lab Fritz-Bosch-Lab X-Ray Lab target Beavertail
  NucAR lab  Not logged in ELOG logo
Message ID: 10     Entry time: Fri Dec 11 10:44:45 2020
Author: Jan 
Category: misc 
Subject: screen config and specialties 
A brief summary of handy features of screen useful, e.g., for daq operation.

1. invoke screen with a prepared config file
This will automatically set up a prepared environment
screen -S session-name -c config_file
an example config_file is attached: ".screen_e127"
it includes key-bindings, several prepared tabs and a bunch of commands for each tab and was used in 2020 for e127 experiment.

2. send external commands into a specific tab of a specific screen session
screen -S e127 -p 0 -X stuff "^C"
screen -S e127 -p 0 -X stuff "sleep 2;./start.sh^M"
screen -S e127 -p 4 -X stuff "sleep 10; empty stream://r4l-58 --server=stream:6002^M"
With this the remote control of screen by a GUI or so is possible.
This injects ctrl-c:
stuff "^C"

And each command has to submitted with the concluding <RETURN>:
stuff "top^M"

3. enable passwordless ssh inside a screen
When you invoke screen as a child of ssh-agent and you have encrypted ssh-keys set, you need to type the passphrase only once before opening the screen. Any internal ssh then won't need password.
exec /usr/bin/ssh-agent xterm -g 100x20 -e "ssh-add; screen -S session-name -c config_file" &
Here you start an xterm that will be killed as soon as the screen terminates. Only inside this xterm your ssh-agent has the keys. ssh-add will only find keys in default location ~/.ssh/ but you could also specify a certain key.
Attachment 1: .screen_e127  1 kB  | Show | Show all
ELOG V3.1.5-fc6679b