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