#!/bin/sh
#
# FILE   : stop-monitor   
# PERMISSIONS: r-x------   
# OWNER:  root
# SUMMARY: This file is called by a root crontab entry.  
#          It terminates the PPP monitor process at the 
#          end of a work day.   Yes, we do have an 
#          unlimited account, but why monopolize the 
#          ISP's modem for no good reason?
#
# If the monitor pid file is present then the program is 
# running. Stop it.
#
if [ -r /var/run/monitor.pid ]; then
	kill -INT `cat /var/run/monitor.pid`
#
# If unsuccessful, ensure that the pid file is removed.
#
	if [ ! "$?" = "0" ]; then
		echo "removing stale monitor pid file."
		rm -f /var/run/monitor.pid
		exit 1
	fi
#
# Success. Terminate with proper status.
#
	echo "PPP link monitor is stopped"
	exit 0
fi
