Solved

A script to push Solaris Patches to 200 servers

Posted on 2008-10-31
2
331 Views
Last Modified: 2013-12-27
I have a total of 250 Solaris servers and I am looking for a script to enable me push patches/packages
0
Comment
Question by:benmartins
2 Comments
 
LVL 48

Accepted Solution

by:
Tintin earned 500 total points
ID: 22854249
You definitely want a push instead of pull?

There's quite a few options available.  Simplistically, you could just use scp (assuming you have ssh keys setup), eg:
#!/bin/sh
for host in `cat /list/of/hosts`
do
  scp /path/to/patch $host:/patch/dir
done

Open in new window

0
 
LVL 40

Expert Comment

by:omarfarid
ID: 22854292
you may use scp or ftp to send the patches to these servers.

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:/remdir
done
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

813 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now