Implemented shutdown scripts for all supported instances

The shutdown script is called when an instance reboots or powers off.
The script may be killed if it runs for over two minutes.
Minor nit from the existing code: change $* to "$@" (i.e. at-sign instead of asterisk and use double quotes) on this line and the next. In this case it probably makes zero difference, but both for reasons of Google style guide and the rare cases where they differ, we should always use the second unless we specifically know otherwise.