Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

252
Visualizações
Can I attach screen after system restart?

I used to create a screen and use vim to trace source code. I usually use the commands to create, detach and attach a screen to keep my vim status. $ screen -S vim_src1 [CTRL+a] d to detach the screen $ screen -r vim_src1 However, screen status will be killed after system restart. Can I attach screen after system restart?

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

After a system restart there is no screen session to attach. You can certainly create a new session.

A screen session that you could attach has been running since you detached it. A system restart kills all of the processes (including those running in screen).

In desktop environments, you may see occasional support for saving "session" state. Doing that relies upon each application to save its state when asked, e.g., on system shutdown. That can be workable for large GUI applications (which are designed to handle events). But in contrast, screen is mostly used for shell applications where this is done rarely.

Rather than require each application to save/restore itself, it is conceivable that the operating system could be designed to do this. But that does not appear to be the case for the systems we are using.

Further reading:

  • How to Automatically Remember Running Applications from Your Last Session in Ubuntu 14.04
  • How can I keep restore for apps in Lion without having session restore when I log in?
over 4 years ago · Santiago Trujillo Relatório

0

I can interpret your answer in a few ways, because I'm not 100% certain what your objective is. I'll try to give the two most obvious options I'm aware of.

You can configure your screen session with ~/.screenrc so it always launches the same with, with labels and for screens, and it will even launch applications for you. For example:

defutf8 on
caption always "%{= kK} %{K}%-w%{+b w}%51>%n %t%{= K}%+w%<%-=%{= kK} me@localhost | %{w}20%y-%m-%d %{w}%0c:%s %{-}"
shelltitle '$|$'
defscrollback 10000
termcap xterm|xterms|xs ti=\E7\E[?47l
terminfo xterm|xterms|xs ti=\E7\E[?47l
startup_message off
screen -t vim       0  vim $HOME/todo.txt 
screen -t ipython   1  ipython
screen -t finch     2  finch
screen -t mutt      3  mutt
screen -t top       4  top

chdir $HOME/Repos/git
screen -t CL        5   
screen -t git       6

If you actually want to be able to save a session that you're in you might consider using screen-session.

https://github.com/skoneka/screen-session

Session saver currently supports saving of: layouts, scrollbacks, titles, filters and is able to restart programs run in windows. It recognizes regular, group and zombie windows. Currently there is no support for serial and telnet window types. By default, session saver also tries to save Vim sessions using ":mksession" and ":wviminfo".

Session saver accesses important data by directly reading /proc filesystem and sorts processes by parent pid. There is almost no "stuffing" of commands into windows (except when saving Vim sessions) so there is no interaction with programs itself.

During session loading, every new window starts with screen-session-primer (a small C program) which displays a list of processes and asks user what to do: whether to start none, some or all of window's processes or directly starts programs provided "--force-start [win_num]" option was used.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda