Next Previous Contents

10. le fichier /usr/sbin/ppp-off

Voici le fichier /usr/sbin/ppp-off fabriqu? par la distribution Slackware 3.4.0 . Il en vaut bien un autre. ppp-off est le nom de la commande pour terminer la communication.


#!/bin/bash
#
# This is the standard ppp-off script that comes with ppp-2.?.?, it's
# been expanded to include the -d option for pppsetup. (10-17-97)
#
######################################################################
#
# Determine the device to be terminated.
#
if [ "$1" = "" ]; then
        DEVICE=ppp0
elif [ ! "$1" = "-d" ]; then
        DEVICE=$1       
elif [ "$1" = "-d" ]; then
        DEVICE=ppp0     
elif [ ! "$1" = "" ] && [ "$2" = "-d" ]; then
        DEVICE=$1       
fi
######################################################################
#
# 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 the kill did not work then there is no process running for this
# pid. It may also mean that the lock file will be left. You may wish
# to delete the lock file at the same time.
        if [ ! "$?" = "0" ]; then
                rm -f /var/run/$DEVICE.pid
                echo "ERROR: Removed stale pid file"
                exit 1
        fi
#
# Success. Let pppd clean up its own junk.
        echo "PPP link to $DEVICE terminated."
        if [ "$1" = "-d" ]; then
        pppd file "/etc/ppp/options.demand" || exit 1
        echo "Demand Dialing Started..."
        exit 0
        elif [ "$2" = "-d" ]; then
        pppd file "/etc/ppp/options.demand" || exit 1
        echo "Demand Dialing Started..."
        exit 0
        else
        exit 0
fi
fi
#
# The ppp process is not running for ppp0
echo "ERROR: PPP link is not active on $DEVICE"
exit 1


Next Previous Contents