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