Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Updating Client Machines Over SSH
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
Jon Wilder
Tux's lil' helper
Tux's lil' helper


Joined: 04 Apr 2011
Posts: 98
Location: Fresno CA

PostPosted: Sat Oct 10, 2015 6:03 am    Post subject: Updating Client Machines Over SSH Reply with quote

Hi all. Usually when I update my Gentoo machines on my network I work from one machine and update the others over SSH. Problem with this was that if I happened to need or want to restart my main workstation, I would have to wait for all of the clients to finish updating before I could.

That is...until I discovered Screen.

Screen is a wonderful package that allows you to start up a virtual terminal, then detach from the terminal and re-attach to it at a later time. Within a Screen session, I can start the update, then detach from the session and log out of the SSH connection. I can always log back into the host machine via SSH, then reattach to the running screen session and pick up where I left off.

If you don't already have Screen, emerge it -

Code:

localhost / $ emerge --ask app-misc/screen


Install Screen on all of your network clients. Once it's installed, SSH into the client machine (if you're not already) -

Code:

localhost / $ ssh foo@bar


Once logged into the host machine, start a screen session -

Code:

foo@bar ~ $ screen


Then run your normal system update -

Code:

foo@bar ~ $ emerge -auND @world --with-bdeps=y


Once you start the update, you can then detach from the screen session by pressing CTRL + A, followed by the 'D' key. Once detached, go ahead and log out of the host machine.

When you wish to return to the host machine, log in via ssh, then execute the following -

Code:

foo@bar ~ $ screen -list


This will list all available screen sessions. Here is an example from one of my machines -

Code:

jon@Lean-Server ~ $ screen -list
There are screens on:
        10285.pts-0.Lean-Server (Detached)
        12369.pts-0.Lean-Server (Detached)
2 Sockets in /tmp/screen/S-jon.


If I want to reattach to the first screen session, I would execute the following -

Code:

jon@Lean-Server ~ $ screen -r 10285.pts-0.Lean-Server


Your update is still running as if nothing happened (unless it's finished of course).

Screen is a wonderful program for those of you who update all of your client machines over SSH from a main workstation. I highly suggest giving it a try. You'll wonder how you ever lived without it.
Back to top
View user's profile Send private message
1clue
Advocate
Advocate


Joined: 05 Feb 2006
Posts: 2562

PostPosted: Sat Oct 10, 2015 6:29 am    Post subject: Reply with quote

You might want to check out tmux. It's like screen only more so.
Back to top
View user's profile Send private message
dobbs
Tux's lil' helper
Tux's lil' helper


Joined: 20 Aug 2005
Posts: 103
Location: Wenatchee, WA

PostPosted: Sun Oct 11, 2015 9:27 pm    Post subject: Reply with quote

I'm a little frustrated with screen today. The app-misc/screen ebuild was upgraded from 4.0 to 4.3 yesterday, and once again the directory where screen keeps its sockets changed. This time from ~/.screen/ to /tmp/screen/S-$USER. Every time the screen directory changes, existing screen sessions become inaccessible. The processes are still running, and in the past I managed to set $SCREENDIR (or even downgrade screen) and reconnect, but not today. Screen 4.3 doesn't see the 4.0 sessions (probably because 4.0 used FIFOs while 4.3 uses sockets), and the powers that be decided to delete the 4.0 ebuilds. Wonderful.

So keep an eye out for screen upgrades, because you'll end up with orphaned sessions.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 44175
Location: 56N 3W

PostPosted: Sun Oct 11, 2015 9:34 pm    Post subject: Reply with quote

dobbs,

The old ebuilds are in the attic.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Irre
Guru
Guru


Joined: 09 Nov 2013
Posts: 347
Location: Stockholm

PostPosted: Sun Oct 11, 2015 11:14 pm    Post subject: Reply with quote

I often use "nohup" to build heavy packages on Raspberry
Code:
ssh <rasp>
nohup emerge -v gcc&
exit

the build will run in background and you can log in later
Code:
ssh <rasp>
tail -f nohup.out
to follow output log :)
Back to top
View user's profile Send private message
Tony0945
Advocate
Advocate


Joined: 25 Jul 2006
Posts: 3296
Location: Illinois, USA

PostPosted: Sun Oct 11, 2015 11:47 pm    Post subject: Reply with quote

I use atrun usually +5 minutes, then logout.
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7197

PostPosted: Mon Oct 12, 2015 12:29 am    Post subject: Reply with quote

At least for emerge it's easy, you can use genlop -c or tail /var/log/emerge.log to get an idea.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum