Home | History | Annotate | Line # | Download | only in rc.d
ppp revision 1.6
      1 #!/bin/sh
      2 #
      3 # $NetBSD: ppp,v 1.6 2002/03/22 04:33:59 thorpej Exp $
      4 #
      5 
      6 # PROVIDE: ppp
      7 # REQUIRE: mountcritremote syslogd
      8 # BEFORE:  SERVERS
      9 #
     10 #	Note that this means that syslogd will not be listening on
     11 #	any PPP addresses.  This is considered a feature.
     12 #
     13 
     14 . /etc/rc.subr
     15 
     16 name="ppp"
     17 start_cmd="ppp_start"
     18 stop_cmd="ppp_stop"
     19 sig_stop="-INT"
     20 sig_hup="-HUP"
     21 hup_cmd="ppp_hup"
     22 extra_commands="hup"
     23 
     24 ppp_start()
     25 {
     26 	#	/etc/ppp/peers and $ppp_peers contain boot configuration
     27 	#	information for pppd.  each value in $ppp_peers that has a
     28 	#	file in /etc/ppp/peers of the same name, will be run as
     29 	#	`pppd call <peer>'.
     30 	#
     31 	if [ -n "$ppp_peers" ]; then
     32 		set -- $ppp_peers
     33 		echo -n "Starting pppd:"
     34 		while [ $# -ge 1 ]; do
     35 			peer=$1
     36 			shift
     37 			if [ -f /etc/ppp/peers/$peer ]; then
     38 				pppd call $peer
     39 				echo -n " $peer"
     40 			fi
     41 		done
     42 		echo "."
     43 	fi
     44 }
     45 
     46 ppp_hup()
     47 {
     48 	pids="`check_process pppd`"
     49 	if [ -n "$pids" ]; then
     50 		for pid in $pids; do
     51 			kill $sig_hup $pid
     52 		done
     53 	fi
     54 }
     55 
     56 ppp_stop()
     57 {
     58 	pids="`check_process pppd`"
     59 	if [ -n "$pids" ]; then
     60 		for pid in $pids; do
     61 			kill $sig_stop $pid
     62 		done
     63 	fi
     64 }
     65 
     66 load_rc_config $name
     67 run_rc_command "$1"
     68