From owner-freebsd-hackers@FreeBSD.ORG Thu Aug 14 01:22:34 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 863031065678 for ; Thu, 14 Aug 2008 01:22:34 +0000 (UTC) (envelope-from fjwcash@gmail.com) Received: from mail-gx0-f17.google.com (mail-gx0-f17.google.com [209.85.217.17]) by mx1.freebsd.org (Postfix) with ESMTP id 2F3378FC08 for ; Thu, 14 Aug 2008 01:22:34 +0000 (UTC) (envelope-from fjwcash@gmail.com) Received: by gxk10 with SMTP id 10so1834429gxk.19 for ; Wed, 13 Aug 2008 18:22:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; 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=NisQihi01JXZwEDZDcyTEfFMxxHumcMWNOWOwcI6XZU=; b=inl22L1ofA6R6DluzTCARRfSWYYqkRHARuWaUP6zWfl9Nvx8onQQi+NM10Tmr3lq3k HR7XnNcDceQFF0r3/E/ANoaeATa1utcnQey0i0diLbyYx7dP5tOG4B5P655PSjg6dvmm ykft2G+80otlnwIsVKD/l8qBC+hS1EPXRJSxM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=F8oDTtsbXRY7VpP9je9RflCqwqj4HUCyEyUGlLlNy9XkJuVH/lkRokeT6az0RYFrnt BYiii0+adtlkXb0Cx62WTphpXElWZMBqsyhxH1ufyUdrvvuKCThe/SM4JP+2Y+0R8Kpr qMblTK2KJOTNbo4TjeDbbDs4hfQWXWkkGAilo= Received: by 10.151.147.16 with SMTP id z16mr768380ybn.169.1218676953537; Wed, 13 Aug 2008 18:22:33 -0700 (PDT) Received: by 10.151.154.17 with HTTP; Wed, 13 Aug 2008 18:22:33 -0700 (PDT) Message-ID: Date: Wed, 13 Aug 2008 18:22:33 -0700 From: "Freddie Cash" To: "Vincent Hoffman" In-Reply-To: <48A29E15.5080303@unsane.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <78cb3d3f0808120810o54f49373n69ac5076c9a9c9b7@mail.gmail.com> <20080812115132.44b2e8f7@mbook.local> <200808130813.56656.jonathan+freebsd-hackers@hst.org.za> <48A29E15.5080303@unsane.co.uk> Cc: freebsd-hackers@freebsd.org Subject: Re: If not the force, what should I use? (Was: FreeBSD in Business (was Re: Idea for FreeBSD)) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Aug 2008 01:22:34 -0000 On Wed, Aug 13, 2008 at 1:40 AM, Vincent Hoffman wrote: > Jonathan McKeown wrote: >> On Tuesday 12 August 2008 17:51:32 Mike Meyer wrote: >>> On Tue, 12 Aug 2008 17:10:22 +0200 "Adrian Penisoara" >>> Ok, given that you 1) want to have both "XXXX this service if it's >>> part of our normal runtime" and "XXXX this service even if it's not >>> part of our normal runtime" as script commands, and that 2) XXXX >>> without a prefix gets the "if it's part of our normal runtime" >>> meaning, as we want the user to have to explicitly say "Yes, I know >>> this looks odd, but I know what I'm doing so do it anyway" to get the >>> "even if it's not part of our normal runtime" behavior, then what >>> would you have us use instead of "forceXXXX"? >>> >> People keep talking about forcestart. >> >> Unless I'm misunderstanding things horribly, forcestart does exactly that >> - forces the service to start regardless of any error that may occur. >> >> The better option for starting something as a one-off (not enabled in >> rc.conf) is mnemonically named onestart - which only ignores the rcvar but >> still fails on any other error. >> >> And yes, I like having onestart/onestop distinguished from start/stop. >> > I believe it "forces" a start even though its not actually enabled (in > rc.conf) rather than regardless of errors. > If you really want a command line of onestart/onestop install the > sysutils/bsdadminscripts port which has a script called rconestart and > rconestop which do exactly that ;) >From /etc/rc.subr: # run_rc_command argument # Search for argument in the list of supported commands, which is: # "start stop restart rcvar status poll ${extra_commands}" # If there's a match, run ${argument}_cmd or the default method # (see below). # # If argument has a given prefix, then change the operation as follows: # Prefix Operation # ------ --------- # fast Skip the pid check, and set rc_fast=yes # force Set ${rcvar} to YES, and set rc_force=yes # one Set ${rcvar} to YES Further in the file: case "$rc_arg" in fast*) # "fast" prefix; don't check pid rc_arg=${rc_arg#fast} rc_fast=yes ;; force*) # "force prefix; always run rc_force=yes _rc_prefix=force rc_arg=${rc_arg#${_rc_prefix}} if [ -n "${rcvar}" ]; then eval ${rcvar}=YES fi ;; one*) # "one" prefix; set ${rcvar}=yes _rc_prefix=one rc_arg=${rc_arg#${_rc_prefix}} if [ -n "${rcvar}" ]; then eval ${rcvar}=YES fi ;; esac Which, if I follow things, means: ** "/etc/rc.d/$script faststart" won't check for existing PID files or already running apps, and just run $script, but still checks if $script_enable=yes is in /etc/rc.conf. ** "/etc/rc.d/$script onestart" sets $script_enable=yes internally, regardless of what is in rc.conf, and runs $script. All other checks are done as per normal. ** "/etc/rc.d/$script forcestart" runs $script, regardless of what's in rc.conf, the status of the PID file, or the existence of an already running daemon. What most people in this thread are looking for is onestart. -- Freddie Cash fjwcash@gmail.com