Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

A script to push Solaris Patches to 200 servers

Posted on 2008-10-31
2
Medium Priority
?
344 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
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.:
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

886 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