I am trying to record a value on each shutdown; that is each 'poweroff' or 'reboot'. Searching pointed me towards /etc/init.d/rc.shutdown, and /etc/inittrd.. (/opt/shutdown.sh is not called on these commands).
A simplified example of what i am trying to do would be 'echo "test" > /opt/test'.. after reboot /opt/test is either empty or unchanged.
I put the above command at the start of rc.shutdown, or in the form;
...
::restart:echo "test" > /opt/test
::restart:/etc/init.d/rc.shutdown
::restart:/sbin/init
...