script to log power on and poweroff

Carlos Becker f0877e61f2f879f5a1244afbbc63a01c at 2013.temporarily.de
Wed Nov 23 17:20:06 UTC 2011


Thanks Clint,

> Wouldn't it be easier to just use wtmp though?

I need a script that does the work for me, triggered by power off/on.

Thanks for the "start on starting ..." hint.
But this did not work on shutdown, I have no clue why.

But this is now working for me:


description     "logmytime"

start on starting rc RUNLEVEL=[0123456]
stop  on stopping rc RUNLEVEL=[0123456]

post-start script
        echo "start $(date)" >> /home/me/logmytime.log
end script

post-stop script
        echo "stop $(date)" >> /home/me/logmytime.log
end script




More information about the upstart-devel mailing list