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