Skip to content

A tool to make screen sessions persistent = survive system reboot.

License

Notifications You must be signed in to change notification settings

simonwalz/screen-save

Repository files navigation

screen-save

A tool to make screen sessions persistent = survive system reboot.

Save a screen session

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]
Options
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.
Using session names

Start a screen session with screen -S SESSIONNAME or rename an existing session by CTRL + A, : and session SESSIONAME

Example

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

Load a screen session

Use screen:

screen -c .screenrc_{SESSIONNAME}
Option Description
-c custom screen configuration file
.screenrc_{SESSIONNAME} Path to the configuration file

Automatically start sessions at system start

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.

Automatically save all my session

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.

Remove a saved session

Just remove the saved screenrc file:

rm ~/.screenrc-{SESSIONNAME}

Installation

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

Limitations

  • Screen Version 4.01 is needed, to support queried commands.
  • Does not work on macOS, because there is no /proc filesystem. (Maybe with procfs on MacFUSE)
  • Changing the number of a window is not supported. The window number is read from the environment, which can not be updated by screen.
  • Saving window layouts is not jet implemented.

About

A tool to make screen sessions persistent = survive system reboot.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages