I’ve discovered that a recent automatic migration of my Compute Engine VM instance has caused by mysql not to shutdown correctly and thus the restart took much longer do to checks.
Is there a way to initiate and wait for mysql service to shutdown for the VM maintenance/migration?
Advertisement
Answer
Think you are looking for shutdown scripts. Using which you request to wait about 90 seconds before GCE will forcibly terminates your instance.
You set your shutdown script instance metadata
gcloud compute instances create example-instance
--metadata-from-file shutdown-script=examples/scripts/install.sh
Hope this helps.