Em vez de usar screen -r
, que tenta retomar uma sessão de tela, você pode usar screen -R
, que tenta retomar uma sessão de tela e cria uma nova, se não existir.
-r [pid.tty.host]
-r sessionowner/[pid.tty.host]
resumes a detached screen session. No other options (except com-
binations with -d/-D) may be specified, though an optional prefix
of [pid.]tty.host may be needed to distinguish between multiple
detached screen sessions. The second form is used to connect to
another user's screen session which runs in multiuser mode. This
indicates that screen should look for sessions in another user's
directory. This requires setuid-root.
-R attempts to resume the first detached screen session it finds. If
successful, all other command-line options are ignored. If no
detached session exists, starts a new session using the specified
options, just as if -R had not been specified. The option is set
by default if screen is run as a login-shell (actually screen uses
"-xRR" in that case). For combinations with the -d/-D option see
there.
Pessoalmente, costumo usar screen -DRA
.
-D -R Attach here and now. In detail this means: If a session is run-
ning, then reattach. If necessary detach and logout remotely
first. If it was not running create it and notify the user.
This is the author's favorite.
-A Adapt the sizes of all windows to the size of the current termi-
nal. By default, screen tries to restore its old window sizes
when attaching to resizable terminals (those with "WS" in its
description, e.g. suncmd or some xterm).