#!/bin/sh
#
# g_locked
#
# Usage: g_locked
#
# By: Angel Corbera, TSID1, Refinery Isla, Curacao, N.A.
# Comments to: [email protected]
#
# Purpose: Retrieve list of locked CPs from their Hosts in the system
# Run it from an AP or AW only!.
#
echo "Getting CPs list...\c"
CPS=`sort /etc/cplns`
ME=`uname -n`
rm HOSTS tmp1 tmp2 > /dev/null 2>&1
touch HOSTS tmp1
echo "Getting HOSTs lists...\c"
for x in $CPS
do
awk '$1=="'$x'" {print $2}' /usr/fox/sp/sldb >> tmp1
done
sort -u tmp1 > HOSTS
echo "Done."
#
# 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
cat tmp2
else
rexec $x /usr/bin/ls -l /usr/fox/sp/locks > tmp1
awk ' $0 ~ /\+$/ {print substr ($NF,2,length($NF)-2)}' tmp1 > tmp2
cat tmp2
fi
done
echo "\n"
rm tmp1 tmp2