Hey Ivan,

On Fri, Mar 10, 2006 at 02:23:42AM +0000, Ivan A. Beveridge wrote:

> I try the -D in either place and it makes no difference (as expected):
> /usr/local/sbin/sfacctd -f /path/to/config/file -D
> /usr/local/sbin/sfacctd -D -f /path/to/config/file
> 
> This is bizarre ... I could have sworn that I had this working with -D
> previously, but it doesn't work for me with 0.10.0rc1 or 0.10.0rc3.

That's pretty easy to explain: since the beginnings, commandline options
and -f have been (and still are) mutual exclusive. Using the latter, makes
the file content to overwrite the configuration generated by commandline
options. I remember the thought behind this was to keep things clear and
avoid races like "-D" and "daemonize: false". 

> I'm just trying to get an rc file running, and I would prefer to ensure
> that sfacctd is started as a daemon (ie with the -D flag in the rc
> startup file) rather than relying on it being in the config file ...
> that is where I'm coming from.
> 
> Any pointers gratefully accepted :)

My suggestion for your rc file is: 

DAEMONIZE=`cat <cfg file> | grep daemonize | grep -v "^\s*\!" | wc -l`

If $DAEMONIZE is 1 then everything is ok. Otherwise, ie. it is 0, you
should either a) stop things with an error message on the screen or b)
think to continue appending the daemonize line:

echo -e "\ndaemonize: true" >> <cfg_file>

Cheers,
Paolo

Reply via email to