Tell me more ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am using GNU screen a lot. I find it very annoying that everytime the server has to be rebooted I lose all my sessions (even if I know in advance, I need to set-up everything again).

I've searched the web for possibilities how to make screen survive a reboot, but found nothing that works for me. Some of the methods I found and there flaws:

  • CryoPID: seems to be dead, promising since 2005 to include support for screen
  • DMCTP: has problems with setuid(), didn't work for me (I admit I didn't try very hard)
  • some script trying to recreate the session from scratch; you still lose your history and I think also the environments variables are not correctly set (and when I tried it didn't bring up all sessions)

Maybe somebody knows some better process freezer? This seems to be the most promising way.

share|improve this question
Maybe you should hibernate instead of rebooting :-) I remember using DMCTP a long, long time ago and it worked (IIRC, but i'm not sure...) – Mr. Steak Sep 28 '10 at 8:39
1  
Well, in most cases its kernel updates or hardware replacements that force a reboot. (Which is not up to me anyway...) -- DMCTP: Would be interested in how to make it work without recompiling screen (as suggested on the Internet). – fuenfundachtzig Sep 29 '10 at 10:31
I'm using tmux instead of screen and find it easier to write session scripts. That doesn't "save" your session but you can easily send commands to tmux to do your layout and send 'key strokes' to the client so you can change directory and launch applications if needed. I'm sure you can do it in screen as well, but it's just seem easier with tmux – mb14 Sep 30 '10 at 9:18

migrated from stackoverflow.com Sep 29 '11 at 9:27

1 Answer

There is no way to save a screen session in the fashion that you desire. What I did was the next best thing: scripted autossh to connect to my servers and set up my rig the way I like it.

Love it.

Local connection down, I wait, it comes back up and there's my work ( I use nested screens ). Server down or rebooted, I wait, and am back in my default position. This gives me the feeling of continuity that I desired.

Anyway, I asked this exact question years ago on the screen list.

Summary: Seek not eternal life for screen. Instead learn to resurrect.

This is the meat of the .screenrc config:

There is an example, rscreen, in the autossh package that I modified into the econnect program.

The --esc parameter is to set the remote screen escape to something different ( my escape is `)

#add much much more scrollback
defscrollback 10000

# make some default windows

screen -t ADMIN     1
chdir /Users/chiggsy/Sites/
screen -t SITES    2
chdir /Users/chiggsy/src/
screen -t SRC 3
chdir
screen -t FERGUS  4 /Users/chiggsy/bin/econnect --host host.example.com --port 50000 --esc g --user sol
screen -t LAEG 5  /Users/chiggsy/bin/econnect --host host.example2.com --port 505000  --esc g --user invictus

screen -t ROOT      0   sudo su -m
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.