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