#! /bin/bash #Author : Richard DEMONGEOT. #Licence : GPL v2. see http://www.fsf.org/licensing/licenses/info/GPLv2.html for more options. # Tries to connect to physical server in order to class them by OS. One output file by OS. # This script needs GetDNSZone.sh written by Stéphane BORTZMEYER. set -x Directory=/where/you/want/your/-OS-file. ZoneFile=/where/you/have/put/your/zone/file. if [ -z "$1" ] then echo "Usage: $0 zone" > /dev/stderr exit 1 fi zone=$1 ./GetDNSZone.sh $zone if [ $? -ne 0 ] then exit 1 fi #Purge des fichiers précédents rm -rf ${Directory} mkdir -p ${Directory} grep " A " $ZoneFile | awk '{print $5}' | sort | uniq > ${Directory}/ServerList for IP in `cat ${Directory}/ServerList` do INFOS=`$ForeignComand $IP "uname -a"` SYSTEME=`cat $INFOS | awk '{print $1}'` HOTE=`cat $INFOS | awk '{print $2}'` VERSION=`cat $INFOS | awk '{print $3}' echo $HOTE ($IP) -- $VERSION >> ${Directory}/${SYSTEME} done exit 0