diff options
author | emax <emax@FreeBSD.org> | 2007-10-18 17:10:40 +0000 |
---|---|---|
committer | emax <emax@FreeBSD.org> | 2007-10-18 17:10:40 +0000 |
commit | 8cbbb2bafc0f1b543fc812303ef5b9dda2f92590 (patch) | |
tree | 3fc6065a21ba8c95a3b1f9f05e5abae256a65bde /etc | |
parent | 1f6b3a5f2c43971b35cacb43e695cfb721cfb5f6 (diff) | |
download | FreeBSD-src-8cbbb2bafc0f1b543fc812303ef5b9dda2f92590.zip FreeBSD-src-8cbbb2bafc0f1b543fc812303ef5b9dda2f92590.tar.gz |
Teach /etc/rc.d/ppp how to start/stop individual instances
of ppp. This is an extension of previous commit.
Submitted by: Yuri Kurenkov < y dot kurenkov at init dot ru >
Reviewed by: mtm
MFC after: 3 days
Diffstat (limited to 'etc')
-rw-r--r-- | etc/rc.d/ppp | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/etc/rc.d/ppp b/etc/rc.d/ppp index f9ff885..b5ca7df 100644 --- a/etc/rc.d/ppp +++ b/etc/rc.d/ppp @@ -13,6 +13,7 @@ name="ppp" rcvar=`set_rcvar` command="/usr/sbin/${name}" start_cmd="ppp_start" +stop_cmd="ppp_stop" start_postcmd="ppp_poststart" ppp_start_profile() @@ -60,11 +61,16 @@ ppp_start_profile() ppp_start() { - local _p + local _ppp_profile _p + + _ppp_profile=$* + if [ -z "${_ppp_profile}" ]; then + _ppp_profile=$ppp_profile + fi echo -n "Starting PPP profile:" - for _p in $ppp_profile; do + for _p in $_ppp_profile; do echo -n " $_p" ppp_start_profile $_p done @@ -80,5 +86,32 @@ ppp_poststart() /etc/rc.d/pf resync } +ppp_stop_profile() { + local _ppp_profile + + _ppp_profile=$1 + + /bin/pkill -f "^${command}.*[[:space:]]${_ppp_profile}\$" || \ + echo -n "(not running)" +} + +ppp_stop() { + local _ppp_profile _p + + _ppp_profile=$* + if [ -z "${_ppp_profile}" ]; then + _ppp_profile=$ppp_profile + fi + + echo -n "Stopping PPP profile:" + + for _p in $_ppp_profile; do + echo -n " $_p" + ppp_stop_profile $_p + done + + echo "." +} + load_rc_config $name -run_rc_command "$1" +run_rc_command $* |