I have a daemon that throws an exception whenever I shutdown or reboot. However, stopping it with kill -15, or calling the stop command in its start stop script (in /etc/init.d/) results in correct termination.
Therefore, might it be that shutdown or reboot call an initial script in which I can stop the daemon, and then delay a little?
Thanks, Mike.