Listing 1: uupager
#!/bin/csh -f
#######################################################################
#
# Function : uupager
# Parameters : pager machine target
# Remarks : works in tandem with uucp pager configuration.
# For security, I would set this file as follows :
#
# permissions = -rwxrwx---, user = root, group = staff
#
# History ---------+----------+------------------------------------
# Programmer | Date | Changes / Comments
# -----------------+----------+------------------------------------
# Carlos F. Gomez | 11/07/93 | Created
# -----------------+----------+------------------------------------
#
#######################################################################
#
if (${#argv} < 1) \
then
clear
echo "Usage: $0 <p_request>"
echo " Where the <p_request> is one of the following pager requests :"
echo " p_tmp_overflow p_ats_finished p_modem_works p_page_root"
exit(1)
endif
#
# Setup environment variables...
#
setenv AKBAR /tmp/$$.$user.uupager.buf1
setenv JEFF /tmp/$$.$user.uupager.buf2
setenv VERBOSE 1
#
# Try 4 times to page user :
#
foreach num ( first second third fourth )
#
# Wait for uucp to finish transaction if necessary...
#
setenv UUCP_ACTIVE 1
#
# Loop indefinitely until UUCP is NOT active...
#
while ( $UUCP_ACTIVE == 1)
setenv UUCP_ACTIVE 0
ps auxww \
| awk ' { if ($1 == "uucp") \
{ print "setenv UUCP_ACTIVE 1" } \
} ' \
> $AKBAR
source $AKBAR
if ( $UUCP_ACTIVE == 1) \
then
if ( $VERBOSE == 1) \
echo "waiting 2 minutes for open line..."
sleep 120
endif
end
if ( $VERBOSE == 1) \
echo -n "Calling $num time, wating 1 minute for call to succeed"
( /usr/bin/cu $1 > $AKBAR) >& $JEFF &
sleep 60
end
echo "done"
#
# END uupager
#
|