#!/usr/bin/ksh
#
# start keep_alive script for wan
#
# modification history:
#
# tm    980203  initial  release
# tm    980227  added start/stop functionality
###################################################################             
prog=$(basename $0)
LOG=/var/log/wan_monitor
MONITOR=/usr/local/bin/wan_keep_alive

case "$1" in
   start)
       print "$prog:  starting wan monitoring keep_alive..."
       savelog -c 7 ${LOG}
       if [ -x $MONITOR ] ; then
          $MONITOR >${LOG} 2>&1 &
       else
          print "couldn't locate $MONITOR"
       fi
       ;;
    stop)
       print "$prog:  stoping wan monitoring keep_alive..."
       KILLPID=$(pidof -x $(basename $MONITOR))
       if [ -n $KILLPID ] ; then
          kill $KILLPID
       fi
       ;;
    *)
       echo "Usage: $prog {start|stop}" >&2
       exit 1
    ;;
esac                                                                            

exit 0
