In the previous section on installing PPP, the commands to set up
and tear down the PPP link were given. However, these are a bit
unwieldy, so I prefer to use the following two scripts:
ppp-on
to bring up the link, and ppp-off
to tear it
down again.
ppp-on
Save
the ppp-on script to
/usr/sbin/ppp-on
, and make it executable:
#! /bin/sh # # Script to set up a PPP link. # # Usage: ppp-on [-p port] [-s speed] [script] # # Set yer defaults here # port=/dev/modem script=das speed=38400 verbose= while [ -n "$1" ]; do case $1 in -p) shift; port=$1;; -s) shift; speed=$1;; -v) verbose=-v;; *) break;; esac shift done if [ $# -gt 0 ]; then script=$1 shift fi pppd $port $speed modem crtscts defaultroute lock \ netmask 255.255.255.0 "$@" \ connect "chat $verbose -f /etc/ppp/chat/$script"
ppp-off
Save
the ppp-off script to
/usr/sbin/ppp-off
, and make it executable:
#! /bin/sh # # Take down PPP links. # # Usage: ppp-off [interface ...] # - if no interface specified, will kill 'em all! # cd /var/run if [ $# -gt 0 ]; then for int in $*; do echo "Taking down $int." kill -HUP `cat $int.pid` done else echo "Taking down all interfaces." kill -HUP `cat ppp*.pid` fi