From owner-freebsd-rc@freebsd.org Wed Feb 10 22:57:07 2016 Return-Path: Delivered-To: freebsd-rc@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C27D1AA51C2 for ; Wed, 10 Feb 2016 22:57:07 +0000 (UTC) (envelope-from andy@fud.org.nz) Received: from mail-yw0-x22e.google.com (mail-yw0-x22e.google.com [IPv6:2607:f8b0:4002:c05::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8DDD21E5B for ; Wed, 10 Feb 2016 22:57:07 +0000 (UTC) (envelope-from andy@fud.org.nz) Received: by mail-yw0-x22e.google.com with SMTP id q190so26800700ywd.3 for ; Wed, 10 Feb 2016 14:57:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fud-org-nz.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=wH7ZXJYjZ1sfdRfnID6BhtUY1zP2z4WmwxfGXpo3uw4=; b=C+GX81Ci3gP/dW90eS0eRLSYRjmQyOaiX8e+FnBC2+O3sRfedW8xHdlLOX4aMpkbf1 o9WK0ygnAJbxhK2PdX32krqHiELUBTDC4insql9E0AE2KAY7Nh2N5GuHBYezMXbaT/Fl kcJGyAIvTFRuFYWkqjxD2xUyh9SxPnWZYeJ7aCBY2a+Gw8XjFJqrdPn8vTqDfne6JOP0 rIJ7zRs7sj2XxKjVrM9rpBwThNMkvRQPKVKRHnjZbJpAMZCw7QXEuMAHSCetz6DM06Sk om8n1m8UZy9KlyggxiNyZW28Hs1AmsyrVla1zSd0uKSOL7ctstxSt6a6rqqdoTHIb8Ln HDXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=wH7ZXJYjZ1sfdRfnID6BhtUY1zP2z4WmwxfGXpo3uw4=; b=Rx8y7scQRppncH8Bfo7p/ArSaxhn+PXiO5oX+5WmekuylpzHzg2/IZpg0Rn6Ubjnsi Ss+NvKaTA2dzaH+i72c9uRnjj2AeZghBUuQhFU2WSzPQuPGYABcWDBvu8r20eX/UDylZ OiiTAaEmZSCprtXs125ULLaCAMiJvbiYh4RltsCVkaN1hzeW5cR++DILm0xKYsa2EizI isqsTDnI/ONGv9ReHewtsId9iVwOXPO0hHXVFW45dU/KgNOjuOe4c9dJn4OwwT5gWFS7 qhVCrjyMjvwKhPlrNBHxdOV54Mu0fdQE6qir7hAAtW0Lr/KucvnpMqT37Jo8ONxoHKIl hXIQ== X-Gm-Message-State: AG10YOSdJxCD9I1O48/dbXGsN47WHdSd4/PWOumv4GtjgpwrGJOPeXQuhFAbI2cp70MOe6b7/KGuJRxMWTeU7g== MIME-Version: 1.0 X-Received: by 10.13.202.135 with SMTP id m129mr12600312ywd.170.1455145026243; Wed, 10 Feb 2016 14:57:06 -0800 (PST) Received: by 10.129.134.70 with HTTP; Wed, 10 Feb 2016 14:57:06 -0800 (PST) In-Reply-To: <22203.48400.34474.502294@hergotha.csail.mit.edu> References: <22203.48400.34474.502294@hergotha.csail.mit.edu> Date: Thu, 11 Feb 2016 11:57:06 +1300 Message-ID: Subject: Re: Good example for startup script with multiple "profiles"? From: Andrew Thompson To: Garrett Wollman Cc: freebsd-rc@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.20 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: Wed, 10 Feb 2016 22:57:07 -0000 On 11 February 2016 at 11:43, Garrett Wollman wrote: > It's sometimes useful to have a single rc script start multiple copies > of the same service, using different options. (For example, and my > use case here, running a monitoring daemon with different parameters > on "inside" and "outside" network interfaces.) Is there a good > example I can crib from for how best to code this up while taking > maximal advantage of the rc.subr framework? > Slightly different but the openvpn startup script uses the filename as the variable prefix and you start multiple copies by linking the file to a new name. Works well. # This script supports running multiple instances of openvpn. # To run additional instances link this script to something like # % ln -s openvpn openvpn_foo # and define additional openvpn_foo_* variables in one of # /etc/rc.conf, /etc/rc.conf.local or /etc/rc.conf.d/openvpn_foo Andrew