As described there, I set up a cron job to back up our low-budget file server to an external USB drive and turn it off for the night.
After a while, it became painfully obvious that
shutdown -P now
was, at best, intermittently successful at turning off the power. The shutdown sequence would sometimes hang near the end, with a blank screen, after unmounting all the drives (so there are no logs), with the power on. Keyboard & mouse were dead, tapping the power button produced a display about acpid being unhappy, but nothing I could follow up.
Oddly, that same command issued from a terminal window would work perfectly for as long as I was willing to restart the machine.
Even more oddly, the box would shut off properly from the GUI or the GDM login scren.
A puzzlement…
After several days of tedious “try this” experimentation and rummaging through the scripts in /etc/init.d/, it seems this command works in the cron job the way it’s supposed to
halt -p -f
The -p calls for a power-down and -f says to force the halt (rather than calling shutdown, which we know won’t work).
So, finally, I can hack 25% off the power bill for that thing.
Memo to self: some day, figure out exactly how the whole shutdown sequence works.