Can't 'dhcpd -d' in background ?

Simon Hobson dhcp1 at thehobsons.co.uk
Thu Jul 13 15:18:48 UTC 2006


Joe Bill wrote:

>       >> run 'dhcpd' as root, off it goes on it's own, running in 
>the background.
>       >>
>       >> run 'dhcpd -d', there it runs in the foreground, locking up 
>your terminal.
>       >>
>
>       > I think you've answered your own question (in part).
>       > d=debug ? If you use -d then the process needs to have sterr
>       > connected - which effectively means it needs to stay connected to the
>       > terminal if started from the command line.
>
>       Hello Simon. Thanks for your lightning fast reply!
>      
>       '-d' = debug ? needs to have stderr connected to a terminal ?
>       Well, but the man page says "dhcpd log to the standard error 
>descriptor",
>       not that it needs a terminal connected.

If you are invoking it from a terminal, then sterr will be associated 
with that terminal.

>       Is it that unreasonable to expect that, invoking 'dhcpd -d' 
>detaches dhcpd if
>       invoking 'dhcpd' does, in light of how the man page describes 
>the '-d' option ?

I don't see why that has to be, but I can see why it would be 
considered consistent. As to why it is that way, probably Ted Lemon 
would be the person to ask - I would assume that it's main function 
was seen to be as a debugging tool where -d would imply -f.

>       Can't we expect that '-d' still detaches the dhcpd process, as it's done
>       without the option, and that if we really want the dhcpd process to run
>       in the foreground, only then would we specify the '-f' option, 
>additionally
>       to '-d' ?
>      
>       > I assume the -f option is for situations where some process (system
>       > management tool ?) is going to start it as a child and monitor it -
>      
>       You mean like some "debug" mode ? Aren't the '-d' and '-f' options doing
>       the same thing then, that is simply running in the foreground ?

No, by monitor it, I mean start a child and do something if the 
process exits - ie control returns to the calling process. Very much 
like, when you invoke a program from the terminal, if it runs 
silently then you know it's finished when the terminal gets control 
back and prints the command prompt. As a very simple example (that 
only now comes to mind), it would be possible to invoke dhcpd from 
inittab - using respawn as the mode and '-f' as an option to dhcpd. 
This would then run dhcpd as a child of inittab, and restart it any 
time it quit.

>       Simon, the man page says :
>
>       "-d flag ... can be useful at sites where complete log of all 
>dhcp activity
>       must be kept but syslogd is not reliable or otherwise cannot be used."
>      
>       This makes plenty of sense to me.
>       This provision hints nothing about connected terminals or 
>foreground processes.

No, because I would expect that in such situations, you would have a 
wrapper (shell script or whatever) which set up sterr to go wherever 
you want, then start dhcpd. You would then use whatever tools the 
system provides to background the wrapper and dhcpd with it.


But of course, as this is all open source, you have the means there 
to modify it if there is something that you aren't happy with. I'm 
sure any patches would be considered.

Simon


More information about the dhcp-users mailing list