#!/bin/sh

DEVICELIST="ppp0 ppp1"
LOGFILE=/var/adm/pppd_log

# kill alarm
if [ -f /var/run/alarm.pid ]
then
	kill `cat /var/run/alarm.pid`
	rm -f /var/run/alarm.pid
fi

# loop over all devices
for DEVICE in $DEVICELIST 
do

#
# If the ppp? pid file is present then the program is running. Stop it.
if [ -r /var/run/$DEVICE.pid ]; then
	kill -INT `cat /var/run/$DEVICE.pid`
#
# If unsuccessful, ensure that the pid file is removed.
#
	if [ ! "$?" = "0" ]; then
		echo "removing stale $DEVICE pid file."
		rm -f /var/run/$DEVICE.pid
		exit 1
	fi
#
# Success. Terminate with proper status.
#
	echo "$DEVICE link terminated"
	echo "ppp-off \`$DEVICE':          " `date` >> $LOGFILE
	hostname ralf
else
#
# The link is not active
#
	echo "$DEVICE link is not active"
fi

done

