I have a script that I use to do this for my classroom, have 20 primary
machines, and about 30 other systems, but this is just a single command.
I like using the putty plink command to do the connection.
Here is a sub-set of the script. Define the comand and then run the command
as a background task to the other system. (Actually, 101 is the machines
itself), and then 19 other machines in this one. replace real password with
{password}.
cmd="hostname ; dnf clean metadata ; dnf update -y "
plink -t 192.168.7.101 -l root -pw {password} "$cmd" &
plink -t 192.168.7.201 -l root -pw {password} "$cmd" &
plink -t 192.168.7.202 -l root -pw {password} "$cmd" &
plink -t 192.168.7.203 -l root -pw {password} "$cmd" &
plink -t 192.168.7.204 -l root -pw {password} "$cmd" &
I have another script that is usefull to monitor the progress, since running
the
3 update scripts works on 54 different systems.
look3 script
while [ -n "`ps -ef | grep plink | grep -v "grep plink"`" ] ; do
clear
ps -ef | grep plink | cut -d- -f 2 | grep -v grep | cut -d\ -f 2 | sort -n
| column
-c 70
ps -ef | grep plink | cut -d- -f 2 | grep -v grep | wc -l
sleep 10
done
echo ""
That displays the IP addresses of the machines that are being processed,
and the count of home many are currently running. Open another terminal
window, and run time ./look3
That shows the status and number, and then reports the total time it took to
complete.
Again, plink is part of putty, so need to install putty if it isn't already.
On 4 Mar 2017 at 9:41, bruce wrote:
From: bruce <[email protected]>
Date sent: Sat, 4 Mar 2017 09:41:31 -0500
Subject: Running local SSH as background process - possible??
To: Community support for Fedora users
<[email protected]>
Send reply to: Community support for Fedora users
<[email protected]>
> Ok guys,
>
> I know this isn't strictly "Fed" related, but the group might have
> suggestions.
>
> My use case, the process has a number of remote servers. I'd like to
> be able to run a bunch of commands on the remote servers as fast as
> posible. The initial thought was to loop through the different
> IPAddresses, and SSH into each server, to run the commands.
>
> However, this process was still "sequential" in that each SSH session
> needs to complete, prior to running the next server/ssh command.
>
> So, my question/need -- is to figure out how to run a ssh as a
> background on the local server. This approach would/should allow the
> process to quickly fire off commands to the remote ipaddresses/servers
> in a much faster/parallel manner.
>
> sortof:
>
> foreach iplist as ipaddress
>
> ssh user1@ipaddress command & (assuming that the '&' runs the local
> ssh in the background -- it doesn't!)
>
>
> Running "stuff" on the remote can occur in a "Screen" session, which
> would allow the ssh process to fire off the remote cmd, but it still
> doesn't run the local ssh as a "background" process..
>
> Rick has mentioned/discussed the "Screen" function in past threads.
>
> Thoughts/comments....
> _______________________________________________
> users mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
+----------------------------------------------------------+
Michael D. Setzer II - Computer Science Instructor
Guam Community College Computer Center
mailto:[email protected]
mailto:[email protected]
Guam - Where America's Day Begins
G4L Disk Imaging Project maintainer
http://sourceforge.net/projects/g4l/
+----------------------------------------------------------+
http://setiathome.berkeley.edu (Original)
Number of Seti Units Returned: 19,471
Processing time: 32 years, 290 days, 12 hours, 58 minutes
(Total Hours: 287,489)
BOINC@HOME CREDITS
ABC 16613838.513356 | EINSTEIN 129817509.788695
ROSETTA 58150514.717077 | SETI 101559023.269076
_______________________________________________
users mailing list -- [email protected]
To unsubscribe send an email to [email protected]