Google Compute Engine - 等待 systemd 服務退出並關閉時顯示 0

Google Compute Engine - 等待 systemd 服務退出並關閉時顯示 0

我在 Google Compute Engine 上有幾個實例。在那裡我有一個帶有ExecStop選項的 systemd 服務。腳本執行可能需要很長時間(5-10 分鐘)。

關閉 GCE 實例時,會執行此腳本,但它尚未完成,因為 GCE 實例在完成之前關閉並忽略它。

正確地完成和完整地完成這個劇本是非常重要的。

來自Google文件:

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.

有沒有辦法告訴 GCE 等待 systemd 服務完成停止?

相關內容