From owner-freebsd-rc@FreeBSD.ORG Fri Oct 12 18:41:21 2007 Return-Path: Delivered-To: freebsd-rc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5912716A417 for ; Fri, 12 Oct 2007 18:41:21 +0000 (UTC) (envelope-from maksim.yevmenkin@gmail.com) Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.185]) by mx1.freebsd.org (Postfix) with ESMTP id D635C13C45D for ; Fri, 12 Oct 2007 18:41:20 +0000 (UTC) (envelope-from maksim.yevmenkin@gmail.com) Received: by nf-out-0910.google.com with SMTP id b2so826622nfb for ; Fri, 12 Oct 2007 11:41:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=nYc3vSZqoTcTwqc+D0j+sCgV5S7Gt8DYTfwNKNZvoF0=; b=CA/dvJEcC0Fjpw/ASYFFNZm6WP9pWc5zQNuVllmQnm06+Jm1bPjhrQ/ul9gr7Gpnt5yBrdM9NFG5i2X2qGp849BNQ3JZwaDNYHPideXZ+DNTytlMEy+VQSRaun5IMBQccfJVPb7vNFLj7IbPc3n8ECXm9mMbyUz8amenD2A5OFo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=oUfGZz+7aBQ3CHnKo90xioaD+NELClT/TwKR0BiyXF7hE5b3gAwPGlSMUTXu4lHc3mzFwHZQRrw09OU/Rdls+PKITMKn8IKn25nDlrnnAVmoBeqdeHtSR6HNOeX48kVf1vnoEXc3c+G/ntSEiSVlUyiJ1ZkpYeZtKqbl+hZL6kk= Received: by 10.86.54.3 with SMTP id c3mr2579317fga.1192214479567; Fri, 12 Oct 2007 11:41:19 -0700 (PDT) Received: by 10.86.25.9 with HTTP; Fri, 12 Oct 2007 11:41:19 -0700 (PDT) Message-ID: Date: Fri, 12 Oct 2007 11:41:19 -0700 From: "Maksim Yevmenkin" To: "Mike Makonnen" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20071006215757.GA10458@terra.mike.lan> <20071007110815.GA16458@terra.mike.lan> Cc: freebsd-rc@freebsd.org Subject: Re: multiple instances of ppp X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion related to /etc/rc.d design and implementation." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Oct 2007 18:41:21 -0000 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