run a task as close to poweroff as possible

Clint Byrum clint at ubuntu.com
Fri Mar 9 17:58:14 UTC 2012


Excerpts from Tim Gopp's message of Fri Mar 09 09:16:05 -0800 2012:
> Hello,
> 
> how can I run a task as close before the real poweroff as possible?
> I have to turn off a display and LEDs to indicate that the machine is powerd off 
> now and it is save to switch the power off.
> 
> I'm trying to run the task with "start on runlevel [06]" but this is still 
> ~3sec ahead of the real poweroff.

Your best bet for all current releases of Ubuntu  is to do this in
a sysvinit script, as the shutdown is still done via the sysvinit
compatibility mode for runlevel 0.

If you make it run at position 89, it should run right before halt. So

update-rc.d your-script start 89 0



More information about the upstart-devel mailing list