Upgrading over ssh and connection failure
Tom H
tomh0665 at gmail.com
Mon Aug 13 15:12:19 UTC 2018
On Mon, Aug 13, 2018 at 9:56 AM Colin Law <clanlaw at gmail.com> wrote:
> On Sun, 12 Aug 2018 at 20:36, J <dreadpiratejeff at gmail.com> wrote:
>>
>> Perhaps. But doing updates over ssh in a screen session isn’t a bad
>> idea in any case. If for no other reason than if you do, for some
>> reason, lose the connection, it minimizes handed of fallout due to
>> losing the session when the connection dies.
>
> Thanks all for the suggestions. I didn't know about screen so that is
> something on my list to investigate.
I meant to write this earlier but I was in a hurry.
screen and tmux are equivalent to X-less WMs for a terminal. They
allow you to run multiple shell sessions within one login or ssh
session, just like you can have multiple terminal sessions in a WM or
DE session; and keep those sessions live and "re-attachable-to" while
logged off/ssh-ed off.
To show you what this means in practice, the tmux absolute basics (I
haven't used screen for 8 or 9 years so the only thing that I
100%-remember is that it's "ctrl-a ctrl-d" to detach) for your
use-case are:
ssh:
ssh remote_host
create tmux session:
tmux new
update:
apt-get update
upgrade:
apt-get dist-upgrade
detach:
ctrl-b d
ssh:
exit
[later...]
ssh:
ssh remote_host
attach to tmux session:
tmux attach
[...]
close tmux session:
ctrl-d ## exit the shell session
If you want to have more than one tmux session, you can add "-s
session_name" and "-t session_name" to the "new" and "attach" commands
respectively so as to name your sessions and not have to remember what
sessions "0", "1", ... are. If you (mistakenly?) run "tmux attach"
while having multiple sessions running, IIRC, you'll attach to the
last session from which you detached.
I prefer to create another window or another pane within a window if I
need more than one shell session rather than create another tmux
session, so I don't bother with naming my unique session; and I have
shorter commands...
To go back to the WM analogy, starting another tmux session is similar
to starting another WM session on another VT. Creating a new window is
similar to opening a new terminal window in a WM. Creating a new pane
is similar to opening a new tab in a terminal window.
Hopefully, this isn't too confusing an intro to what screen and tmux represent!
More information about the ubuntu-users
mailing list