How to specify a daemon shutdown command with upstart?

Using exec to start the process is fine, but when stopping it, if you absolutely need to run a specific script or set of commands, you can use the pre-stop stanza.

pre-stop exec shutdown.sh

I assume you have tried just using an exec stanza and it didn't work, possibly because your daemon requires some specialized cleanup. Note that well-behaved daemons should receive a signal from upstart when the job is stopped, and if they handle the signal appropriately no additional cleanup should be needed.

Stopping a job involves sending SIGTERM to it. If there is anything that needs to be done before SIGTERM, do it here. Arguably, services should handle SIGTERM very gracefully, so this shouldn't be necessary.

if there is anything critical, like a flush to disk, and raising kill timeout is not an option, pre-stop is not a bad place to do it

Also read this section for the entire workflow of what happens when you stop a job. Notice when pre-stop is run, and how a signal is sent to the process afterwards, which is how upstart handles stopping jobs normally.

My source is the official Upstart cookbook at: http://upstart.ubuntu.com/cookbook/