#!/bin/sh # # get_cio # # Usage: get_cio # # By: Angel Corbera, TSID1, Refinery Isla, Curacao, N.A. # Comments to: corbera@rocketmail.com # # Purpose: Retrieve list of AW/WPs running Control Configurator, # and list of LOCKED CPs. # As usual, it must be run from /opt/ac, on any 50/51 station # in the system. # get_wp() { grep opt tmp1 > /dev/null if [ $? -eq 0 ] then # 50 or 51 Z=`awk '{print $5}' tmp1 | head -1` if [ $Z = "ciocfgtask.nhi" ] then # 50 awk '{print $7}' tmp1 | tr / " " > tmp2 awk '{printf "WP = %-8s is running ICC\n",$5}' tmp2 >> CIOHOSTS else # 51 awk '{print $10}' tmp1 | tr / " " > tmp2 awk '{printf "WP = %-8s is running ICC\n",$5}' tmp2 >> CIOHOSTS fi else # AP 20 RAWWP=`awk '{print $10}' tmp1 | tr / " "` WP=`echo $RAWWP | awk '{print $3}' | sed 's/ciocfg//'` fi } # cd /opt/ac rm CIOHOSTS HOSTS tmp1 > /dev/null 2>&1 touch CIOHOSTS HOSTS tmp1 echo "\n\n\n\n\n\n\n" # CPS=`sort /etc/cplns` ME=`uname -n` echo "Getting CP Hosts in the system ... :" for x in $CPS do awk '$1=="'$x'" {print $2}' /usr/fox/sp/sldb >> tmp1 done sort -u tmp1 > HOSTS cat HOSTS echo "\n" # ME=`uname -n` # # "Checking Hosts ... " for x in `cat HOSTS` do echo "Checking $x ... \c" TYPE=`awk ' $1=="'$x'" {print $2}' /usr/fox/sp/hldb` echo "($TYPE) \c" if [ $TYPE = "303" ] || [ $TYPE = "308" ] || [ $TYPE = "309" ] || [ $TYPE = "1001" ] then echo "(PW/20/51 type) ... " if [ $x = $ME ] then ps -ef | grep -v grep | grep ciocfgtask > tmp1 if [ $? -eq 0 ] then get_wp echo " on AP = $x" >> CIOHOSTS fi else rexec $x /usr/bin/ps -ef | grep ciocfgtask > tmp1 if [ $? -eq 0 ] then get_wp echo " on AP = $x" >> CIOHOSTS echo "\n" fi fi else echo "(50 type) ......... " if [ $x = $ME ] then ps -ax | grep -v grep | grep ciocfgtask > tmp1 if [ $? -eq 0 ] then get_wp echo " on AP = $x" >> CIOHOSTS fi else rexec $x /usr/bin/ps -ax | grep ciocfgtask > tmp1 if [ $? -eq 0 ] then get_wp echo " on AP = $x" >> CIOHOSTS fi fi fi # echo "Done!" done echo "\n=========================================" echo "\nStations running Control Configurator: \n" if [ -s CIOHOSTS ] then cat CIOHOSTS else echo "\nNone!" fi echo "\n=========================================" # # Querying CP hosts for locked CPs: # for x in `cat HOSTS` do echo "\nLocked CPs for host $x:" if [ $x = $ME ] then ls -l /usr/fox/sp/locks > tmp1 awk ' $0 ~ /\+$/ {print substr ($NF,2,length($NF)-2)}' tmp1 > tmp2 if [ -s tmp2 ] then cat tmp2 else echo "None!" fi echo "-----------------------------------------" else rexec $x /usr/bin/ls -l /usr/fox/sp/locks > tmp1 awk ' $0 ~ /\+$/ {print substr ($NF,2,length($NF)-2)}' tmp1 > tmp2 if [ -s tmp2 ] then cat tmp2 else echo "None!" fi echo "-----------------------------------------" fi done rm tmp1 tmp2