Home | History | Annotate | Line # | Download | only in rc.d
ppp revision 1.8
      1  1.1     lukem #!/bin/sh
      2  1.1     lukem #
      3  1.8  christos # $NetBSD: ppp,v 1.8 2004/10/11 15:00:51 christos 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.1     lukem start_cmd="ppp_start"
     18  1.5     fredb stop_cmd="ppp_stop"
     19  1.5     fredb sig_stop="-INT"
     20  1.5     fredb sig_hup="-HUP"
     21  1.5     fredb hup_cmd="ppp_hup"
     22  1.5     fredb extra_commands="hup"
     23  1.1     lukem 
     24  1.1     lukem ppp_start()
     25  1.1     lukem {
     26  1.1     lukem 	#	/etc/ppp/peers and $ppp_peers contain boot configuration
     27  1.1     lukem 	#	information for pppd.  each value in $ppp_peers that has a
     28  1.1     lukem 	#	file in /etc/ppp/peers of the same name, will be run as
     29  1.4   hubertf 	#	`pppd call <peer>'.
     30  1.1     lukem 	#
     31  1.1     lukem 	if [ -n "$ppp_peers" ]; then
     32  1.1     lukem 		set -- $ppp_peers
     33  1.1     lukem 		echo -n "Starting pppd:"
     34  1.1     lukem 		while [ $# -ge 1 ]; do
     35  1.1     lukem 			peer=$1
     36  1.1     lukem 			shift
     37  1.1     lukem 			if [ -f /etc/ppp/peers/$peer ]; then
     38  1.1     lukem 				pppd call $peer
     39  1.1     lukem 				echo -n " $peer"
     40  1.1     lukem 			fi
     41  1.1     lukem 		done
     42  1.1     lukem 		echo "."
     43  1.5     fredb 	fi
     44  1.5     fredb }
     45  1.5     fredb 
     46  1.5     fredb ppp_hup()
     47  1.5     fredb {
     48  1.8  christos 	pids="$(check_process pppd)"
     49  1.5     fredb 	if [ -n "$pids" ]; then
     50  1.5     fredb 		for pid in $pids; do
     51  1.5     fredb 			kill $sig_hup $pid
     52  1.5     fredb 		done
     53  1.5     fredb 	fi
     54  1.5     fredb }
     55  1.5     fredb 
     56  1.5     fredb ppp_stop()
     57  1.5     fredb {
     58  1.8  christos 	pids="$(check_process pppd)"
     59  1.5     fredb 	if [ -n "$pids" ]; then
     60  1.5     fredb 		for pid in $pids; do
     61  1.5     fredb 			kill $sig_stop $pid
     62  1.5     fredb 		done
     63  1.1     lukem 	fi
     64  1.1     lukem }
     65  1.1     lukem 
     66  1.2     lukem load_rc_config $name
     67  1.1     lukem run_rc_command "$1"
     68