home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- #
- # Generate config, start/stop dialer daemon (gateway - modem0)
-
- . /etc/system.cfg
- . /etc/colors
- . /etc/chat.pwd
- . /etc/live.cfg
-
- [ "$ROUTER" = dialup ] || exit
-
- fn2() { ps | sed -n '/ diald/P'; }
- stp() {
- [ "`fn2`" ] || return
- echo -n "Stopping diald... "
- killall diald -15
- killall connect
- sleep 2
- killall connect -9
- =
- }
- str() {
- [ "$MTU0" ] && a="mtu $MTU0"
- [ "$MRU0" ] && b="mru $MRU0"
- cat >/etc/ppp/options.$MODEM0<<-EOF
- name $LOGIN
- EOF
- c="pppd-options noauth"
- [ "$ADRTYPE" = dynamic ] && c="$c noipdefault"
- [ "$USEPEERDNS" != n ] && c="$c usepeerdns"
- [ "$LOGDIALD" = y -o "$BOOTMOD" = debug ] && d="debug 31"
- [ "$LOGPPPD" = y -o "$BOOTMOD" = debug ] && c="$c debug"
- [ "$MODEM" ] && MODEM0=$MODEM
- [ "$RTRCNT" ] && e="retry-count $RTRCNT"
- [ "$DRTRCNT" ] && f="died-retry-count $DRTRCNT"
- [ "$RBKOFF" ] && g="redial-backoff-limit $RBKOFF"
- [ "$DFAILIM" ] && h="dial-fail-limit $DFAILIM"
- [ "$FPTOUT" ] && i="first-packet-timeout $FPTOUT"
- RDTOUT=${RDTOUT:-5}
- cat >/etc/diald.conf <<-EOF
- $DRULES
- device /dev/$MODEM0
- speed $MSPEED0
- $ADRTYPE
- local $LOCAL
- remote $REMOTE
- modem
- crtscts
- $a
- $b
- $c
- $d
- linkname dialup
- mode ppp
- connect /etc/connect
- defaultroute
- redial-timeout $RDTOUT
- $e
- $f
- $g
- $h
- $i
- fifo /etc/diald.ctl
- run-prefix /tmp
- path-route /bin/route
- path-ifconfig /bin/ifconfig
- path-pppd /sbin/pppd
- EOF
- echo -n "Starting diald... $CR"
- if [ "$MODEM0" ]; then
- fork diald
- [ "`echo $DRULES|sed 's/accept\ any\ //;s/\ any//'`" = 1 ] && control force >/dev/null && echo -n "${CR}Force "
- =
- else
- echo "Error - MODEM0 is not configured.$CW"
- return 2
- fi
- }
-
- case "$1" in
- start) str;;
- stop) stp;;
- restart)stp;str;;
- status) if [ "`fn2`" ]
- then echo "Running diald:"; fn2
- else echo No running diald
- fi;;
- esac
-
-