OpenELEC/OpenELEC.tv — pull request #2097 by tetzlav (2013-03-20 20:46:51+00:00)
Title: Added shutdown script:

Call of user script in /storage/.config/shutdown.sh from /etc/init.d/93_xbmc.
It also gets the current exit code of xbmc.bin (quit|powerdown|reboot) as parameter ($1), so the script can differentiate spezial actions.