From CCDSH
Revision as of 17:46, 17 November 2020 by imported>Rszakats
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

With the recent environments, it is not necessary anymore to spend the night in the observing room of the telescopes. Instead, we can use the instruments via the local network. This is a very comfortable way to obtain our measurements with the telescopes, but it has its own risks. For example, in case of network failure, our running terminals on m9 or m5 will be terminated.

To work safely with the telescopes, it is recommended to use the screen program.

Introduction

This program creates a virtual terminal, which can be detached, so it can run in the background. In case of network failure, our screen session also runs further in the background, with our currently running programs, for example a ccdsh terminal.

Also, there is a small complementary program, called screenie, which can be useful to manage our screen sessions.

Usage

First, we have to log in to the telescope control computer:

ssh -X jhondoe@m*.konkoly.hu

After that, we can start the screenie auxiliary program, just by typing:

screenie

We will see a greeting "window":

screenie - terminal screen-session handler



 a) new session
 q) quit

 A parameter character can be appended to session selection:
   'x' to attach selected session with 'screen -x' command,
   'd' to attach selected session with 'screen -rd' command.

select: 

Here, we can create a new screen session, or quit the screenie program.

Typing a and pressing enter will create a new session. We can name it (for example ccdsh) and give a job description. After that, we see something like this in screenie:

screenie - terminal screen-session handler

 1) 22963.ccdsh (11/26/2014 02:38:35 PM)

 a) new session
 q) quit

 A parameter character can be appended to session selection:
   'x' to attach selected session with 'screen -x' command,
   'd' to attach selected session with 'screen -rd' command.

select:

Typing 1 and pressing enter will attach our terminal to a screen virtual terminal, named ccdsh. In this terminal we can use any commands or programs, like in a normal terminal.

Important hotkeys

To use screen effectively, we need some basic hotkeys. To create a new virtual terminal in our screen, press ctrl+a c

To change between virtual terminals, press ctrl+a [0-9]

To detach from screen: ctrl+a d


If we detach from our screen terminal, our currently running programs in the virtual terminals continue to run. The case is the same, if we have network failure, our virtual terminals continue to run in our screen. This is not the case if we use some programs, which has GUI (for example ds9), because they will be terminated during a network failure.

To reattach to screen, we can use screenie. Simply start it, and type the number of our screen session, hit enter, and we are back at our virtual terminals.

Or we can use screen directly. First, we have to list our current screen sessions: screen -ls

This will give an output like this:

There is a screen on:
        22963.ccdsh     (11/26/2014 02:38:35 PM)        (Detached)
1 Socket in /var/run/screen/S-rszakats.

After this, we can reattach our session: screen -r 22963

In some cases, for example if we use this screen session from an other computer, we have to use the -x switch to force screen to reattach to our session: screen -x 22963

When we finish our work in screen, type exit in every virtual terminal to close them. After that, if we started our session from screenie, we are back at the starting screenie window, where we type q and press enter to quit. If we started our session from screen directly, we will get back to our default terminal.

For further information please see the screen manual: screen manual page. This manual is also accessible directly on the control computers by typing man screen or man screenie.