#!/bin/sh # # $FreeBSD: src/etc/rc.d/ppp-user,v 1.4 2003/04/18 17:55:05 mtm Exp $ # $DragonFly: src/etc/rc.d/ppp-user,v 1.4 2005/11/19 21:47:32 swildner Exp $ # # PROVIDE: ppp-user # REQUIRE: netif isdnd . /etc/rc.subr name="ppp" rcvar="ppp_enable" start_cmd="ppp_start" stop_cmd="ppp_stop" ppp_start() { # Establish ppp mode. # if [ "${ppp_mode}" != "ddial" -a "${ppp_mode}" != "direct" \ -a "${ppp_mode}" != "dedicated" \ -a "${ppp_mode}" != "background" ]; then ppp_mode="auto" fi ppp_command="/usr/sbin/ppp -quiet -${ppp_mode}" # Switch on NAT mode? # case ${ppp_nat} in [Yy][Ee][Ss]) ppp_command="${ppp_command} -nat" ;; esac ppp_command="${ppp_command} ${ppp_profile}" echo "Starting ppp as \"${ppp_user}\"" su -m ${ppp_user} -c "exec ${ppp_command}" # Re-Sync ipfilter so it picks up any new network interfaces # /etc/rc.d/ipfilter resync } ppp_stop() { pids=`check_process /usr/sbin/ppp` if [ -n "${pids}" ]; then for pid in ${pids}; do kill -TERM ${pid} done wait_for_pids ${pids} fi /etc/rc.d/ipfilter resync } load_rc_config $name run_rc_command "$1"