Listing 8: check_in_master_list.ksh--Checks if server should be monitored
#!/bin/ksh
#==================================================
# check_in_master_list.ksh :
# Used for checking whether a host is present
# in the master list.
#
# Parameters :
# arg1 hostname
# arg2 Filename of master list
#
# Return value :
# 0 host is present in the master list
# 1 host not present or commented out
# 2 invalid parameters
#====================================================
if [ $# -ne 2 ] ; then
echo "Usage: $0 <hostname> <master_list>"
exit 2
fi
awk ' { exit_value = 1 ; }
$1 == HOST { exit_value = 0 ; exit ; }
END { exit (exit_value) ; }
' HOST=$1 $2
|