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