From owner-freebsd-rc@FreeBSD.ORG Wed Dec 19 23:07:35 2012 Return-Path: Delivered-To: freebsd-rc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0D64555C; Wed, 19 Dec 2012 23:07:35 +0000 (UTC) (envelope-from utisoft@gmail.com) Received: from mail-bk0-f47.google.com (mail-bk0-f47.google.com [209.85.214.47]) by mx1.freebsd.org (Postfix) with ESMTP id 61D828FC12; Wed, 19 Dec 2012 23:07:33 +0000 (UTC) Received: by mail-bk0-f47.google.com with SMTP id j4so1311924bkw.34 for ; Wed, 19 Dec 2012 15:07:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=qg6/AEKCgvumIZygd8pTc3gjc3trgU5s/oJ3mxzNyn8=; b=oXw/Ynu+vwg3ppbPPM/2bylY/Jw9QHngRjHGV9qo9n80E9IYyKpuyMn2k88aEMd9v5 tdRWdvmM0stRESRstMst8JEup/tUMsb7+M2o9ztaMx278KOYuGZ6MWo0VI1CgiDeSHk+ oyKXU8L6xxz/29AZRBdt12UZgZPJYH/D2K0LDnYBR9uCt6x93CAC2bIazJDR77hl4WDp Cd+dwCLAr79XHv1HuB4TsJ2075yF3aP4rj9czRcJTgslCqyXaJVLLqspAkaoCayPACGn PGn+VlHCcmI1kpxRO0ZZn1ETK7XIMxrk5t3zVhHLxSW4RsFaw+z4rR84nTPxwHH6Ntg5 302g== MIME-Version: 1.0 Received: by 10.204.143.147 with SMTP id v19mr3443448bku.32.1355958447496; Wed, 19 Dec 2012 15:07:27 -0800 (PST) Received: by 10.204.167.71 with HTTP; Wed, 19 Dec 2012 15:07:27 -0800 (PST) In-Reply-To: References: <66E78C5BBEC1BC01C9A7E292@localhost> Date: Wed, 19 Dec 2012 23:07:27 +0000 Message-ID: Subject: Re: Can't get start_precmd to do *anything* From: Chris Rees To: Paul Schmehl Content-Type: text/plain; charset=ISO-8859-1 Cc: FreeBSD RC List , FreeBSD Questions List X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.14 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, 19 Dec 2012 23:07:35 -0000 On 19/12/2012, Paul Schmehl wrote: > --On December 19, 2012 10:47:56 PM +0000 Chris Rees > wrote: > >> On 19/12/2012, Paul Schmehl wrote: >>> I'm working on an rc.d init script for a port, and I am clearly in need >>> of a clue. >>> >>> I have a daemon that requires that a FIFO exist before it will start. >>> The FIFO is defined in the daemon's conf file. I could just point that >>> out to the user using "warn", but I thought it would be nicer to simply >>> take care of it programmatically. >>> >>> So I created this: >>> >>> start_precmd="${name}_ck4fifo()" >> >> Is this a copy/paste error, or is your function actually called >> _ck4fifo or _ch4fifo? >> > > Both, but I fixed it and nothing changed. > >>> ${name}_ch4fifo() >> >> I'm surprised sh isn't choking on this, you can't use ${name} in a >> function name. Indirecting it is a waste of processing time, if I'm >> honest; just use >> >> start_precmd=pads_agent_prestart >> >> pads_agent_prestart() >> { >> do_something >> } >> > > OK, I've done that. Still no change. {{{sigh}}} > > Here's the current invocation: > > start_precmd="pads_agent_ck4fifo()" Lose the parentheses in the above line (this isn't C :) ) Chris > pads_agent_ck4fifo() > { > . ${pads_agent_conf} > if [ ! -p ${PADS_FIFO} ]; then > `/usr/bin/mkfifo ${PADS_FIFO}` > fi > echo "Checking for ${PADS_FIFO}...." > if [ -p ${PADS_FIFO} ]; then > echo "${PADS_FIFO} exists." > return 0 > else > echo "I tried to create ${PADS_FIFO} and failed." > echo "You will need to create it manually before starting > ${name}." > return 1 > fi > } > > -- > Paul Schmehl, Senior Infosec Analyst > As if it wasn't already obvious, my opinions > are my own and not those of my employer. > ******************************************* > "It is as useless to argue with those who have > renounced the use of reason as to administer > medication to the dead." Thomas Jefferson > "There are some ideas so wrong that only a very > intelligent person could believe in them." George Orwell > > -- Chris Rees | FreeBSD Developer crees@FreeBSD.org | http://people.freebsd.org/~crees