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