Listing 2: Power-down "census" script
#!/bin/sh
# Copyright 1994, Lehman Brothers, Inc.
#
# Manifest constants: where does this software live?
# Default to /usr/local/etc. Must be automounted on all hosts
# to be tested
# Note: /usr/local/etc/rpcping is a local utility to test that the
# portmapper is responding
#
SCRIPTHOME=${SCRIPTHOME:=/usr/local/etc}
#
# check usage
#
if [ "$#" = "0" ]; then
echo "Usage: $0 file1 [... fileN]"
exit 1
fi
#
# Take the roll-call
#
echo "Taking roll-call of all hosts in listed in files $*"
for i in `cat $*`; do
echo -n "$i: "
/usr/etc/ping $i 3 >/dev/null 2>&1
if [ "$?" != "0" ]; then
echo "is DOWN (ping)"
elif /usr/local/etc/rpcping $i 3 >/dev/null 2>&1 ; then
echo -n "is UP. "
rsh $i -n ${SCRIPTHOME}/checkdisk
else
echo "is DOWN (rpcping)"
fi
done
|