[olug] System management tools

Vincent.Raffensberger at dtn.com Vincent.Raffensberger at dtn.com
Sat Nov 27 15:16:02 UTC 2004


You could probably accomplish much of what you want ssh key authentication 
and a shell script like this:

Note: what you see here is the main part of a more complex script but the 
general idea is intact.
This has a ton of uses.  Name it "SSH" and use it to run a command on all 
of your systems, like 'SSH /sbin/chkconfig --list xinetd'.
The "more complex" part that I pulled out is mainly cases and arguments to 
target groups of systems.

#!/bin/bash
#SSH
SYSTEM_LIST=/data/scripts/PRE_config/allsystems
SYSTEMS=`cat $SYSTEM_LIST | grep -v ^#`
case $# in
        *)
                case $1 in
                "-q" )
                        QUIET=1
                        CMD=`echo $@ | cut -d\  -f 2-`
                        ;;
                *)
                        CMD=$@
                        ;;
                esac
                ;;
esac
function is_host_up {
        if [ $# -lt 1 ]; then
                echo "Specify a host or ip as an argument."
        else
                echo $1 | fping -t 250 -r 1 -a 2>/dev/null
        fi
}
for system in $SYSTEMS; do
        if [ ! "$QUIET" ]; then
                echo "###############################################"
                echo $system; echo "*****"
        fi
        if [ `is_host_up $system` ]; then 
               ssh $system "$CMD"; 
        else 
              echo "Skipping $system - unavailable"
        fi
        if [ ! "$QUIET" ]; then echo "*****"; fi
done
#EOF




Sean Kelly <smkelly at zombie.org> 
Sent by: olug-bounces at olug.org
11/26/2004 08:44 PM
Please respond to
Omaha Linux User Group <olug at olug.org>


To
Omaha Linux User Group <olug at olug.org>
cc

Subject
Re: [olug] System management tools








Yes. However, sometimes having to log into 24+ machines that all run HP-UX
11i just to turn off a nameserver is a bit silly. I am not looking for a
way to automate my job, as I suspect you realize. I'm looking for a tool 
to
bring sanity and standardization to a currently chaotic and haphazard
environment where each machine is manually tweaked and massaged.





More information about the OLUG mailing list