rc.d: rename vfs_accounting to vfs_quota
[dragonfly.git] / etc / rc.d / ppp-user
CommitLineData
9c600e7d
MD
1#!/bin/sh
2#
3# $FreeBSD: src/etc/rc.d/ppp-user,v 1.4 2003/04/18 17:55:05 mtm Exp $
9c600e7d
MD
4#
5
6# PROVIDE: ppp-user
9118151a 7# REQUIRE: netif
9c600e7d
MD
8
9. /etc/rc.subr
10
11name="ppp"
12rcvar="ppp_enable"
13start_cmd="ppp_start"
d7be5d99 14stop_cmd="ppp_stop"
9c600e7d
MD
15
16ppp_start()
17{
18 # Establish ppp mode.
19 #
20 if [ "${ppp_mode}" != "ddial" -a "${ppp_mode}" != "direct" \
21 -a "${ppp_mode}" != "dedicated" \
22 -a "${ppp_mode}" != "background" ]; then
23 ppp_mode="auto"
24 fi
25
26 ppp_command="/usr/sbin/ppp -quiet -${ppp_mode}"
27
28 # Switch on NAT mode?
29 #
30 case ${ppp_nat} in
31 [Yy][Ee][Ss])
32 ppp_command="${ppp_command} -nat"
33 ;;
34 esac
35
36 ppp_command="${ppp_command} ${ppp_profile}"
37
38 echo "Starting ppp as \"${ppp_user}\""
39 su -m ${ppp_user} -c "exec ${ppp_command}"
9c600e7d
MD
40}
41
d7be5d99
MD
42ppp_stop()
43{
44 pids=`check_process /usr/sbin/ppp`
45 if [ -n "${pids}" ]; then
46 for pid in ${pids}; do
47 kill -TERM ${pid}
48 done
49 wait_for_pids ${pids}
50 fi
d7be5d99
MD
51}
52
9c600e7d
MD
53load_rc_config $name
54run_rc_command "$1"