A tool to make screen sessions persistent = survive system reboot.
The following command saves a screen session to the file ~/.screenrc_{SESSIONAME}
. The created file is compatible with the screenrc definition.
screen-save [-t] SESSIONNAME [SAVE_FILE]
Option | Description |
---|---|
-t |
Use the current screen session. Only works inside a screen session. |
SESSIONNAME |
Name or PID of the screen session to save. |
SAVE_FILE |
(optional) Save session to file. |
Start a screen session with screen -S SESSIONNAME
or rename an existing session by CTRL + A
, :
and session SESSIONAME
create, reattach and save a session:
# create session
screen -S mysession
# reattach to session
screen -x
# save session
screen-save mysession
# load that session again
screen -c ~/.screenrc-mysession
Use screen:
screen -c .screenrc_{SESSIONNAME}
Option | Description |
---|---|
-c |
custom screen configuration file |
.screenrc_{SESSIONNAME} |
Path to the configuration file |
To start the saved screen sessions at system start, start an user crontab via:
crontab -e
and add the script screen-auto-start
:
@reboot /full/path/to/screen-auto-start
The script screen-auto-start
is part of this repository.
Note : You need to enable a crontab to each user. Script works only to a specific user context.
I save my sessions manually, but here is a script to save your sessions periodically:
To start the saved screen sessions at system start, start crontab via:
crontab -e
and add the script screen-save-all-sessions
to save all my sessions every day at 3:00am:
0 3 * * * /full/path/to/screen-save-all-sessions
The script screen-save-all-sessions
is part of this repository.
Just remove the saved screenrc file:
rm ~/.screenrc-{SESSIONNAME}
Alternatives:
Or do it manually:
Close this repository and add it to the path environment.
Copy all scripts to a directory already added to the path environment. E.g. /usr/local/bin