#!/bin/sh
#
# FILE   : Stop-ppp
# SUMMARY: This guy is called at the end of a work day 
#          to shut down the ppp connection by killing 
#          pppd.  It is invoked from a root crontab 
#          entry a few minutes AFTER Stop-monitor 
#          has been invoked.
#
# If the ppp0 pid file is present then the program is 
# running. Aiee Death from above!
#
if [ -r /var/run/ppp0.pid ]; then
	kill -INT `cat /var/run/ppp0.pid`
#
# If unsuccessful, ensure that the pid file is removed.
#
	if [ ! "$?" = "0" ]; then
		echo "removing stale ppp0 pid file."
		rm -f /var/run/ppp0.pid
		exit 1
	fi
#
# Success. Terminate with proper status.
#
	echo "ppp0 link terminated"
	exit 0
fi
#
# The link is not active
#
echo "ppp0 link is not active"
exit 1
