====== AIX tape device-ok lekérdezése sorozatszámmal, PRI/ALT párral (ha van) ====== #!/bin/sh if [[ "$1" != "smc" && "$1" != "all" && -z "$1" ]]; then DEVT='rmt'; echo "rmt eszkozok lekerdezese..." fi if [ "$1" = "all" ]; then DEVT='(rmt|smc)'; echo "rmt&smc eszkozok lekerdezese..." fi if [ "$1" = "smc" ]; then DEVT=$1 echo "smc eszkozok lekerdezese..." fi if [ -e "/tmp/get_serial.out" ]; then rm /tmp/get_serial.out; fi if [ -e "/tmp/get_serial.tmp" ]; then rm /tmp/get_serial.tmp; fi if [ -e "get_serial_`date +%Y%m%d`.out" ]; then rm get_serial_`date +%Y%m%d`.out; fi echo "Bar nem latszik, de epp nagyon dolgozom. Eltarthat percekig is, relax... :)" lsdev -Cc tape|egrep $DEVT|while read line do DEVI=`echo $line|awk '{print $1}'` LOCATION=`echo $line|awk '{print substr($3,1,5)}'` FCS=`lsdev -Cc adapter | grep $LOCATION | awk '{print $1}'` PRIALT=`echo $line|awk '{print substr($3,10,3)}'` lscfg -vl $DEVI > /tmp/get_serial.tmp SERIAL=`cat /tmp/get_serial.tmp |grep Serial|awk '{print substr($2,22,12)}'` TYPE=`cat /tmp/get_serial.tmp |grep Type|awk '{print substr($4,12,8)}'` FMR=`cat /tmp/get_serial.tmp |grep FW|awk '{print substr($2,22,4)}'` echo $DEVI S/N: $SERIAL $FCS Type: $TYPE FW: $FMR $PRIALT >> /tmp/get_serial.out done function seq { beg=$1 end=$2 seq='' while [[ $beg -le $end ]]; do seq="$seq $beg" ((beg=$beg+1)) done echo $seq } while read TAPE do AKT_RMT=`echo $TAPE | awk '{print $1}'` AKT_SER=`echo $TAPE | awk '{print $3}'` AKT_FCS=`echo $TAPE | awk '{print $4}'` SEC_RMTS=`grep $AKT_SER /tmp/get_serial.out | grep -v "$AKT_RMT " | wc -l` for PAIR in $(seq 1 $SEC_RMTS) do SEC_RMT=`grep $AKT_SER /tmp/get_serial.out | grep -v "$AKT_RMT " | head -n $PAIR | tail -n 1 | awk '{print $1}'` SEC_SER=`grep $AKT_SER /tmp/get_serial.out | grep -v "$AKT_RMT " | head -n $PAIR | tail -n 1 | awk '{print $2}'` SEC_FCS=`grep $AKT_SER /tmp/get_serial.out | grep -v "$AKT_RMT " | head -n $PAIR | tail -n 1 | awk '{print $3}'` echo "$TAPE | Pair: $SEC_RMT $SEC_SER $SEC_FCS" echo "$TAPE | Pair: $SEC_RMT $SEC_SER $SEC_FCS" >> get_serial_`date +%Y%m%d`.out done done < /tmp/get_serial.out echo "A vegkimenetet megtalalod az aktualis mappaban a get_serial_"`date +%Y%m%d`".out fajlban is."