-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi Paolo
On 10/03/2006 09:26, Paolo Lucente wrote: > 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 can understand that. I tried with the -D and no "daemonize" line in, and it didn't work. If "daemonize: true" is there, it will background (whether there is a -D or not). If there is no "daemonize" line, it seems to stay in the foreground (whether I use -D or not). Most apps say "command-line takes precedence over config file", which is a nice way to override some settings without having to edit the config files. An example being, you can remove the daemonize line from the config to allow you to debug from the command-line with the process in foreground, but run it from the rc-startup file in background. This is actually what I was trying to achieve. A problem to consider (if you allow the command-line to override the config file) is that you may need/want a "do not daemonize" command-line flag to counter what is in the config file ;) I may try a minimal config file and see whether I can track something down. >> 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> If I did something like this, I'd prefer to "if there is daemonize: line in the file then strip/ignore it and use -D flag". However that would mean I'd need to fiddle around (which is why command-line precedence is easier for me ;) In all honesty, it should always daemonize (and people shouldn't fiddle). The problem may just be that if there is a problem it may get changed to try to debug, and not get put back. Cheers Ivan - -- Ivan Beveridge <[EMAIL PROTECTED]> http://www.linx.net/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFEEapTQQZN5jq7vncRAkMGAJwI2nkcis6Nnc1Vugoo1Hlb5/xMnwCfVWvh IiJ+B6Ha+QekHQ3cJ39uyOw= =8JJn -----END PGP SIGNATURE-----
