SaffronThePuppy
asked on
bash for loop server list from file1, stdOut to file2.
I have a list of servers which I need to install a remote RPM on. I also need to trap stdOut to a text file so I know which ones failed or already had the RPM installed. Can you advise me how to approach this using a for loop in bash or running it as an .sh and calling the contents of the input servers file and the output echo file.?
I'm happy to even do it with Powershell from a Win Host if necesary.
Something like:
For each
$SERVERNAME in FILE1;
Do
StdOut to File2 (I want to see if it is already installed or errors or sudo fails..)
use the following to stdIn:
ssh username@domain@$NextSERVE RNAME
password
yes
sudo su –
password
“rpm -Uvh http://FQDN.packagename.noarch.rpm”
Until EOF
END
You guys Rock, thanks in advance!!
I'm happy to even do it with Powershell from a Win Host if necesary.
Something like:
For each
$SERVERNAME in FILE1;
Do
StdOut to File2 (I want to see if it is already installed or errors or sudo fails..)
use the following to stdIn:
ssh username@domain@$NextSERVE
password
yes
sudo su –
password
“rpm -Uvh http://FQDN.packagename.noarch.rpm”
Until EOF
END
You guys Rock, thanks in advance!!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The expect script here is running on your main server. I've written it as a shell script, with the expect scrip embedded in it. You can call it what you like, the "chmod +x script_name".
ASKER