Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

yum update script

Posted on 2014-12-15
1
Medium Priority
?
424 Views
Last Modified: 2014-12-19
Hi everyone,
I need a script to trigger yum update on a bunch of servers in a seperate list. The list would contain ip address only.
The script would be run from a rhel server on the same subnet as the other servers, and it already has the public key in the other servers authorized keys file

The script im starting with is below...but it would like for the script to reference a list of ip address in the same directory as the script.

#!/bin/bash
# You must have ssh public and private key installed.
#
hosts=(
"ssh root@192.168.100.10 -t sudo  '/usr/bin/yum update -y'"

"ssh root@192.168.100.11 -t sudo  '/usr/bin/yum update -y' "
      )
# simply run array item
for c in "${hosts[@]}"
do
    $c
done
0
Comment
Question by:Peter Kuczynski
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 12

Accepted Solution

by:
andreas earned 2000 total points
ID: 40501617
#!/bin/bash
hosts=$(cat $1)
for i in $hosts ;do
ssh root@$i -t sudo '/usr/bin/yum update -y'
done

then call script with

./scriptname filename.txt

filename.txt should have one ip in one line

each line one ip
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Background Still having to process all these year-end "csv" files received from all these sources (including Government entities), sometimes we have the need to examine the contents due to data error, etc... As a "Unix" shop, our only readily …
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question