benmartins
asked on
A script to push Solaris Patches to 200 servers
I have a total of 250 Solaris servers and I am looking for a script to enable me push patches/packages
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
make the patches as one file (e.g. with tar)
have the 250 servers names in a file, e.g. myhosts (which has names that are in /etc/hosts or dns).
ftp script myscript:
cat myhosts | while read remotehost
do
ftp $remotehost <<-END
cd /dir
binary
put filename.tar
bye
END
done
- make this script executable:
chmod +x myscript
- For ftp to work without providing any username / password, use .netrc file in the user's home directory (the one who will run the script). This file should not be readable by others i.e. use
chmod 400 .netrc
The entry in .netrc should be as below:
machine remoteserver
login remoteusername
password mypassword
remoteserver is the server which is the ftp server where you want to sent the file(s)
remoteusername is the remote user login name on the ftp server
mypassword is the password of the remote user on the ftp server
for more info about .netrc, please use man netrc
here, you may put the details of the usernames and passwords of the 250 servers.
for scp, you need to have similar script but you need to set trust between the 250 servers and the server you are pushing from (so you are not prompted for passwords).
http://waelchatila.com/2005/06/06/1118124232757.html
http://www.cvrti.utah.edu/~dustman/no-more-pw-ssh/
similar to ftp script:
cat myhosts | while read remotehost
do
scp file.tar username@$remotehost:/remd
done