I know with RedHat that when changing to runlevel 0 (halt) - It runs the following script /etc/rc.d/init.d/halt
I'm sure there is a much better way of executing commands at shutdown, rather then hacking at this script. Wether or not you can differentiate between different types of shutdowns, I don't know.
Hopefully this gets you pointed in the right direction.
EDIT: Just saw in you're profile that you are using Slackware. I don't have a Slackware box infront of me (I do at home), but take a look around the /etc/rc.d directory and subdirectories, I'm sure you will find something in there.
Last edited by Kristijan; 10-09-2006 at 05:58 PM.