Solved

A script to push Solaris Patches to 200 servers

Posted on 2008-10-31
2
328 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
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 how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

930 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

13 Experts available now in Live!

Get 1:1 Help Now