NetBSD-Users archive

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

Re: Removing /etc/nologin on shutdown



On Mon, 24 May 2010, Robert Elz wrote:

>     Date:        Sun, 23 May 2010 09:30:13 -0400
>     From:        "Ian D. Leroux" <idleroux%fastmail.fm@localhost>
>     Message-ID:  
> <1274621413.29560.1376468763%webmail.messagingengine.com@localhost>
> 
>   | - If so, is it /sbin/shutdown's job to remove it, or something in the
>   |   /etc/rc.d scripts?  Where should I look to find out why this isn't
>   |   happening as it should?
> 
> It doesn't if you run it with -r or -h (or -p which implies -h) - though
> it probably should.
> 
> If shutdown ever calls its internal finish() function (and -k wasn't used)
> it does unlink /etc/nologin
> 
> But that never happens when it runs with -h or -r - instead shutdown
> exec's reboot or halt.   Those programs know nothing of /etc/nologin,
> and so cannot remove it.

I misunderstand. halt (or reboot) sends SIGTERM to -1. shutdown has a 
handler for that signal which does the finish() (remove the 
/etc/nologin). I may be reading this wrong.

> Most likely, shutdown should be removing /etc/nologin immediately before it
> exec's reboot (or halt) - that would leave a race condition (it would be
> possible for someone to log in in the very small gap between the unlink and
> when reboot (or halt) actually does its thing, but I doubt that's going to
> bother anyone very much.

Or halt/reboot can remove the file as another option.

> What should happen if the exec fails I will leave for someone else to
> ponder!


Home | Main Index | Thread Index | Old Index