I have couple of instances on Google Compute Engine. There I have systemd service with ExecStop option. Script execution may take a significant time (5-10 minutes).

When shutting down GCE instance, this script is run, however it is not finished as GCE instance shutdowns before it finishes and ignores it.

Correct finishing and full completing of this script is very important.

From Google docs:

Stopping an instance causes Compute Engine to send the ACPI Power Off signal to the instance. Modern guest operating systems are configured to perform a clean shutdown before powering off in response to the power off signal.

Is there any way to tell GCE to wait until systemd service finishes stopping?

  • Do you have TimeoutStopSec set for your slow-stopping service? – Ulrich Schwarz Apr 9 '17 at 13:53
  • @UlrichSchwarz yes, it is set to infinity – Rahul Apr 9 '17 at 16:36
  • Google doc: Note: Compute Engine does not guarantee the length of these shutdown periods and we recommend that you do not create any hard dependencies on these time limits. This is terrible – Rahul Apr 9 '17 at 16:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.