PageRenderTime 52ms CodeModel.GetById 30ms app.highlight 3ms RepoModel.GetById 17ms app.codeStats 0ms

/ppp/ip-down

http://github.com/brinkman83/bashrc
Shell | 52 lines | 21 code | 7 blank | 24 comment | 2 complexity | 7a44bcdb7d4a0920669b496bb4d007b5 MD5 | raw file
 1#!/bin/sh
 2#
 3# This script is run by the pppd _after_ the link is brought down.
 4# It uses run-parts to run scripts in /etc/ppp/ip-down.d, so to delete
 5# routes, unset IP addresses etc. you should create script(s) there.
 6#
 7# Be aware that other packages may include /etc/ppp/ip-down.d scripts (named
 8# after that package), so choose local script names with that in mind.
 9#
10# This script is called with the following arguments:
11#    Arg  Name                          Example
12#    $1   Interface name                ppp0
13#    $2   The tty                       ttyS1
14#    $3   The link speed                38400
15#    $4   Local IP number               12.34.56.78
16#    $5   Peer  IP number               12.34.56.99
17#    $6   Optional ``ipparam'' value    foo
18
19# The  environment is cleared before executing this script
20# so the path must be reset
21PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin
22export PATH
23
24# These variables are for the use of the scripts run by run-parts
25PPP_IFACE="$1"
26PPP_TTY="$2"
27PPP_SPEED="$3"
28PPP_LOCAL="$4"
29PPP_REMOTE="$5"
30PPP_IPPARAM="$6"
31export PPP_IFACE PPP_TTY PPP_SPEED PPP_LOCAL PPP_REMOTE PPP_IPPARAM
32
33# as an additional convenience, $PPP_TTYNAME is set to the tty name,
34# stripped of /dev/ (if present) for easier matching.
35PPP_TTYNAME=`/usr/bin/basename "$2"`
36export PPP_TTYNAME 
37
38# If /var/log/ppp-ipupdown.log exists use it for logging.
39if [ -e /var/log/ppp-ipupdown.log ]; then
40  exec >> /var/log/ppp-ipupdown.log 2>&1
41  echo $0 $*
42  echo
43fi
44
45# This script can be used to override the .d files supplied by other packages.
46if [ -x /etc/ppp/ip-down.local ]; then
47  exec /etc/ppp/ip-down.local "$*"
48fi
49
50run-parts /etc/ppp/ip-down.d \
51  --arg="$1" --arg="$2" --arg="$3" --arg="$4" --arg="$5" --arg="$6"
52