#!/bin/sh

DEVICE=ppp0

#
# If the ppp0 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"
        exit 0
fi
#
# The link is not active
#
echo "$DEVICE link is not active"
exit 1
