#!/bin/bash # Fri Apr 21 08:06:26 PDT 2006 PAGER=dlbewley QPAGE=/usr/local/bin/qpage SLEEP=10 proc=$1 does=$2 pager=$3 done=`echo $does |sed 's/s$//'` if [ -z "$proc" -a -z "$does" ]; then echo "Usage: $0 [pager]" echo echo "Proccess will be pgrep'ed for and when it " echo "a page will be sent to the pager via qpage." echo " Default pager is $PAGER." echo " Processes are checked for every $SLEEP seconds." exit 1 fi if [ -z "$pager" ]; then pager=$PAGER fi if [ $does == 'start' -o $does == 'starts' ]; then not='!' fi pid=`pgrep $proc`; while [ $not -n "$pid" ]; do sleep $SLEEP pid=`pgrep $proc` done echo $proc did $done | $QPAGE -p $pager