Solved

A script to push Solaris Patches to 200 servers

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Best way to handle awk return value 6 75
recommend secure & efficient Unix LDAP (equiv of Windows AD) 6 115
UNIX SCP 5 88
Field name with special character (Ñ) in Oracle 11 136
In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
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…
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.:

749 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