Bash script to update remote RHEL distributions
Posted by Marius Voila on April 14, 2010 in London, U.K . — 0 comments This post contains 138 wordsThis bash script will help you to update all servers if you have more then 2 ;) it is very handy
#!/bin/bash
# A shell script to update all remote Redhat Enterprise Linux 5 / CentOS Linux 5 servers
# You must have ssh public and private key installed. This will save a lot of time if you
# have 5-7 servers.
# an array to store all ssh commands
hosts=(
"ssh root@server1.mariusv.com -p222 yum update -y"
"ssh root@server2.mariusv.com -p333 yum update -y"
"ssh root@server3.mariusv.com yum update -y"
"ssh user1@192.168.1.254 -t sudo '/usr/bin/yum update -y' "
)
# simply run array item
for c in "${hosts[@]}"
do
$c
done