[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Re: Getty is spawning to early



John Hasler writes:
Tim Heckman writes:
I've created a dhclient-exit-hook script to handle the processing.
This checks whether the hostname should be set and completes the
process. Only sets it if it really is needed.

Try killing getty in your script (init will respawn it). You may
also need to delay logins so that the user can't log in too early.

I'm not sure why but I hadn't thought of this.  I was hoping to
implement a delay instead of having to kill getty.  I wouldn't want to
nuke getty while someone was logged in doing something as, in theory, it
is possible the hook could be invoked by dhclient. But there would need to be a weird situation for the logic to be in place to cause it to happen.

However, it seems like it may be the best option.  I'll need to do some
testing this weekend/next week and determine if this fits my needs.

BTW how is your script setting the hostname?

When hook gets called by /sbin/dhclient-script and has some variables available to help determine if the hostname should be set. Here is a pastebin of the script itself:

- http://pastie.org/2917845

In short:

if /etc/hostname's size > 0 and
	the variable $new_host_name is non-zero and
	current hostname != hostname obtained by DHCP
then: set the hostname and regenerate /var/run/motd

The $new_host_name variable is the hostname that was provided by the dhcp server.

Thanks for the suggestion John it looks like it may be the winner. If anyone has any further ideas, or suggestions, I'm all ears!

-Tim


Reply to: