From owner-freebsd-rc@FreeBSD.ORG Wed Dec 19 23:03: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 C05F544D; Wed, 19 Dec 2012 23:03:35 +0000 (UTC) (envelope-from prvs=6935c9144=pschmehl_lists@tx.rr.com) Received: from ip-002.utdallas.edu (ip-002.utdallas.edu [129.110.20.108]) by mx1.freebsd.org (Postfix) with ESMTP id 7BFB58FC0C; Wed, 19 Dec 2012 23:03:35 +0000 (UTC) X-Group: None X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AoQCANVG0lCBbgoggWdsb2JhbABErQuRCA4BARYmgkUBAQQBOAI/BQsLDgouITYGE4gBAwkGrm8NiVWLZGmDYmEDiGGLU4sjgWqIJA X-IronPort-AV: E=Sophos;i="4.84,320,1355119200"; d="scan'208";a="112993440" Received: from zxtm01.utdallas.edu (HELO [129.110.200.11]) ([129.110.10.32]) by ip-002.utdallas.edu with ESMTP/TLS/DHE-RSA-AES256-SHA; 19 Dec 2012 17:03:33 -0600 Date: Wed, 19 Dec 2012 17:03:32 -0600 From: Paul Schmehl To: Chris Rees Subject: Re: Can't get start_precmd to do *anything* Message-ID: In-Reply-To: References: <66E78C5BBEC1BC01C9A7E292@localhost> X-Mailer: Mulberry/4.1.0a1 (Mac OS X) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline; size=2007 Cc: FreeBSD RC List , FreeBSD Questions List X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Paul Schmehl 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:03:35 -0000 --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()" 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