Re: Can't get start_precmd to do *anything*

2012-12-20 Thread Paul Schmehl
--On December 19, 2012 11:07:27 PM + Chris Rees utis...@gmail.com 
wrote:


Here's the current invocation:

start_precmd=pads_agent_ck4fifo()


Lose the parentheses in the above line (this isn't C :) )


Well, doh!

I'll figure out how to read some day.

--
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

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Can't get start_precmd to do *anything*

2012-12-19 Thread Chris Rees
On 19/12/2012, Paul Schmehl pschmehl_li...@tx.rr.com 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?

 ${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
}

We always have search and replace in case you choose to modify $name :)

Chris

 {
   . ${pads_agent_conf}
   echo Checking to see if ${PADS_FIFO} exists..
   if [ ! -p ${PADS_FIFO} ]; then
 echo ${PADS_FIFO} did not exist.  Creating it now.
 `/usr/bin/mkfifo ${PADS_FIFO}
   else
 echo ${PADS_FIFO} already exists.
   fi
 }

 When I run the init script with rc_debug enabled, it calls the
 start_precmd, but absolutely nothing happens.  I don't even get the echos.

 # /usr/local/etc/rc.d/pads_agent onestart
 /usr/local/etc/rc.d/pads_agent: DEBUG: checkyesno: pads_agent_enable is set

 to YES.
 /usr/local/etc/rc.d/pads_agent: DEBUG: run_rc_command: start_precmd:
 pads_agent_ck4fifo()
 Starting pads_agent.
 /usr/local/etc/rc.d/pads_agent: DEBUG: run_rc_command: doit:
 /usr/local/bin/sguil-sensor/pads_agent.tcl -D -c
 /usr/local/etc/sguil-sensor/pads_agent.conf
 [root@buttercup4 /usr/ports/security/sguil-sensor-update/sguil-sensor]#
 Error: Unable to read
 /var/data/nsm/sguil-sensor/buttercup4.utdallas.edu/pads.fifo

 I even tried this but got the same result.

 ${name}_ch4fifo()
 {
 warn You must create PADS_FIFO before starting ${name}.
 warn Set PADS_FIFO in the ${pads_agent_conf} file.
 }

 The warn messages aren't in the messages file either, which is expected
 behavior.

 What the heck is going on here?  Is something wrong with rc.subr on this
 host?  Am I missing something?

 --
 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

 ___
 freebsd...@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-rc
 To unsubscribe, send any mail to freebsd-rc-unsubscr...@freebsd.org




-- 
Chris Rees  | FreeBSD Developer
cr...@freebsd.org   | http://people.freebsd.org/~crees
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Can't get start_precmd to do *anything*

2012-12-19 Thread Paul Schmehl
--On December 19, 2012 10:47:56 PM + Chris Rees utis...@gmail.com 
wrote:



On 19/12/2012, Paul Schmehl pschmehl_li...@tx.rr.com 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

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Can't get start_precmd to do *anything*

2012-12-19 Thread Chris Rees
On 19/12/2012, Paul Schmehl pschmehl_li...@tx.rr.com wrote:
 --On December 19, 2012 10:47:56 PM + Chris Rees utis...@gmail.com
 wrote:

 On 19/12/2012, Paul Schmehl pschmehl_li...@tx.rr.com 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
cr...@freebsd.org   | http://people.freebsd.org/~crees
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org