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.
Done.