Date: Fri, 12 Oct 2007 11:41:19 -0700 From: "Maksim Yevmenkin" <maksim.yevmenkin@gmail.com> To: "Mike Makonnen" <mtm@freebsd.org> Cc: freebsd-rc@freebsd.org Subject: Re: multiple instances of ppp Message-ID: <bb4a86c70710121141h1223452bk6c4f88721c4c434@mail.gmail.com> In-Reply-To: <bb4a86c70710070913w158343e3l3eba7bea64c29c91@mail.gmail.com> References: <bb4a86c70710061314j588ce9a9s6922d2c1e7100e6a@mail.gmail.com> <20071006215757.GA10458@terra.mike.lan> <bb4a86c70710061549o14447dfye9553a42ef77cadc@mail.gmail.com> <20071007110815.GA16458@terra.mike.lan> <bb4a86c70710070913w158343e3l3eba7bea64c29c91@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Mike and All, any objections to the following patch as an extension for new /etc/rc.d/ppp? it allows to start/stop individual ppp profiles. thanks, max Index: ppp =================================================================== RCS file: /home/ncvs/src/etc/rc.d/ppp,v retrieving revision 1.14 diff -u -r1.14 ppp --- ppp 12 Oct 2007 16:35:36 -0000 1.14 +++ ppp 12 Oct 2007 18:39:01 -0000 @@ -13,6 +13,7 @@ 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() { - 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 @@ /etc/rc.d/pf resync } +ppp_stop_profile() { + local _ppp_profile + + _ppp_profile=$1 + + 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 $* thanks, max
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bb4a86c70710121141h1223452bk6c4f88721c4c434>