Comment 4 for bug 604908

Revision history for this message
Vagrant Cascadian (vagrantc) wrote : Re: [Bug 604908] Re: Client persistently wants to halt if SHUTDOWN_TIME is set and the current time is between SHTUDOWN_TIME and midnight

> After looking in /usr/share/ldm/rc.d/I01-halt-check I noticed two
> issues. At first, the script does not check if the $SHUTDOWN_TIME
> variable is actually defined (has a value)

Fixed this part of the issue:

  https://bazaar.launchpad.net/~ltsp-upstream/ltsp/ldm-trunk/revision/1560

It's a little cleaner to check if the variable is specified than relying
on the fact that the date command errors out when no value is specified.

> and that the date checks tell the system to always shutdown between
> the shutdown time specified and midnight.

So, there are two places where SHUTDOWN_TIME is used.

In the LTSP portion of the code, it's a cron job that will only be
triggered at the specified time in SHUTDOWN_TIME, and only if there
isn't a logged in LDM session.

In the LDM portion of the code, it's a hook that's run when LDM is
initialized, and as you've noticed, is triggered any time after the time
specified by SHUTDOWN_TIME, on the same date... i.e. between
SHUTDOWN_TIME and midnight. This is in case a user is logged in when the
LTSP cron job is triggered.

I think a cleaner way might be to have the cron job create the
/var/log/ltsp-logout-action file if a user is logged into LDM at the
time the cron job runs, and otherwise reboot. Then LDM will respond
appropriately, but only once. This should allow all the code to be
removed from LDM entirely, and only be present in LTSP.

live well,
  vagrant