Manual on how to run multiple scripts from one terminal.

More
9 years 2 months ago - 9 years 2 months ago #595 by ThibmoRozier
Hello,

This short manual will explain how to use "screen" to create an environment with names screens to go back to and to terminate separately, in the case you would like to.

First off, the installation.
For Debian based Linux, like Ubuntu, Mint and Raspbian:
sudo apt-get install screen

For Redhat based linux, like CentOS:
yum install screen

For OpenSUSE based linux:
yast -i screen

Then, a small explanation on how to use screen:
For in-screen commands you must always use |CTRL| and |A| followed by the command key.
For example, you wish to close the screen but keep the screen and it's child process running, one presses |CTRL| and |A| and |D| at the same time, this is called "Detaching the screen".
Then to stop the script and the screen at the same time, press |CTRL| and |C| at the same time.

Here a list of commands:
  break       ^B b
  clear       C
  colon       :
  copy        ^[ [
  detach      ^D d
  digraph     ^V
  displays    *
  dumptermcap .
  fit         F
  flow        ^F f 
  focus       ^I 
  hardcopy    h
  help        ? 
  history     { }
  info        i
  kill        K k
  lastmsg     ^M m
  license     , 
  lockscreen  ^X x
  log         H
  login       L
  meta        a
  monitor     M
  next        ^@ ^N sp n
  number      N
  only        Q
  other       ^A 
  pow_break   B 
  pow_detach  D
  prev        ^H ^P p ^?
  quit        \ 
  readbuf     < 
  redisplay   ^L l  
  remove      X
  removebuf   =
  reset       Z
  screen      ^C c
  select      ' 
  silence     _
  split       S 
  suspend     ^Z z
  time        ^T t
  title       A
  vbell       ^G
  version     v
  width       W
  windows     ^W w
  wrap        ^R r
  writebuf    >
  xoff        ^S s
  xon         ^Q q

^]  paste .
"   windowlist -b
-   select -
0   select 0
1   select 1
2   select 2
3   select 3
4   select 4
5   select 5
6   select 6
7   select 7
8   select 8
9   select 9
I   login on
O   login off
]   paste .

Now, we want to start the screen.
It is always best to first navigate the terminal to the right directory, using the "cd" command.
Like "cd ~/pyradmon"
Then to start the screen, one can use a variety of commands, I will only cover two.
To start the screen with the script and keep it attached:
screen -m -S {screen name} python pyradmon.py

To start the screen, let is run and come back to do other things with the terminal:
screen -d -m -S {screen name} python pyradmon.py

Showing what screens you have running:
screen -ls

Reattaching to the screen:
screen -r {Screen name}

Don't forget to keep the terminal opened, or I can not guarantee that the screen+script will remain running!

Thank you for reading and I hope it helped you out. :)
Last edit: 9 years 2 months ago by ThibmoRozier. Reason: Making sure I won't get a session time-out whilst writing this manual. :P
The following user(s) said Thank You: mw0uzo

Please Log in or Create an account to join the conversation.

Moderators: Gamma-Man
Time to create page: 0.118 seconds
Powered by Kunena Forum
Everything's free. Please support us by considering a donation. Log in first!
Solar powered Raspberry Pi 4 server stats: CPU 66% Memory 13% Swap 11% CPU temp=54.0'C Uptime 19 Days