#!/bin/ksh # $Id: page.sh,v 1.3 1997/11/23 22:55:27 ksb Exp $ # # Page the DPDP oncall person with a meaningful message. (wam) # # page usage: [interval [threshold]] # interval number of seconds between messages to split on # threshold after first read, how many minutes should a message accumalate # # we are picky about the umask so people can't see private console messages umask 077 PATH=/usr/local/etc:/usr/local/bin:/usr/ucb:/bin:/usr/bin:$PATH PROGNAME=`basename $0` TMP=/tmp/pr$$ interval=${1-5} # Five second default interval threshold=${2-300} # Five minute default threshold mkdir -p $TMP || { echo "$PROGNAME: couldn't make tmp directory $TMP" >&2 exit 1 } while tmbuf -${interval} -t ${threshold} > $TMP/msg$$ do stickee=`oncall` set _ $stickee shift stickee_name=$1 stickee_pin=$2 # 255 character max. Plus 3 dots, and a newline and we're set. dd count=250 bs=1 < $TMP/msg$$ 2>/dev/null > $TMP/trunc$$ if cmp $TMP/msg$$ $TMP/trunc$$ 2>&1 >/dev/null then echo "..." >> $TMP/trunc$$ pagemsg=$TMP/trunc$$ else pagemsg=$TMP/msg$$ fi # page the stickee # should use qpage here XXX Mail ${stickee_pin}@skymail.com < $pagemsg # mail the full message to the group, and log it. cat - $TMP/msg$$ <