xref: /netbsd-src/etc/rc.d/ppp (revision 17dd36da8292193180754d5047c0926dbb56818c)
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
15name="ppp"
16start_cmd="ppp_start"
17stop_cmd="ppp_stop"
18sig_stop="-INT"
19sig_hup="-HUP"
20hup_cmd="ppp_hup"
21extra_commands="hup"
22
23ppp_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
45ppp_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
55ppp_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
65load_rc_config $name
66run_rc_command "$1"
67