blog.up-link.ro android bsd linux unix & open-source world

23May/100

How To Update all CentOS/RHEL servers remotely using a shell script

WP Greet Box icon
Hello there! If you are new here, you might want to subscribe to the RSS feed or subscribe via E-mail for updates on this topic.
#!/bin/bash
#
# A simply shell script to update remote CentOS/RHEL servers
# You must have ssh public and private key installed. This will save a lot of time if you
# have many servers.
#
# by Adi http://blog.up-link.ro
# May 2010

# an array to store ssh commands for each server
hosts=(
        "ssh root@192.168.1.1 yum update -y"
        "ssh root@192.168.2.1 -p 2222 yum update -y"
        "ssh adi@192.168.3.1 -t sudo  '/usr/bin/yum update -y'"
      )
# read the array and launch the ssh command
for sshcmd in "${hosts[@]}";do $sshcmd;done
Print This Post Print This Post
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


*

No trackbacks yet.