2016-09-16 53 views
1

我已經爲我的所有實例設置了啓動腳本,因此當我重新啓動它時,它會自行更新爲最新版本的任何運行。現在我想通過一個腳本來完成其中的多個操作,只需按一下按鈕即可。它通過重新啓動所有相關實例來工作,但我想查看啓動腳本的輸出。如何重定向Google Compute Engine實例啓動腳本的輸出?

從這裏:https://cloud.google.com/compute/docs/startupscript#rerunthescript - 我發現,在Debian機器,引發了啓動腳本本身無需重新啓動機器是通過sudo google_metadata_script_runner --script-type startup完成,從啓動腳本所有輸出爲/var/log/daemon.log。有什麼辦法可以將啓動腳本直接輸出到標準輸出嗎?

+1

不知道,如果它是有用的,但大部分或全部分佈還寫了一個啓動腳本輸出到串行端口(從Web控制檯和gcloud CLI查看)。 – ZachB

回答

1

正如ZachB提到的,在谷歌Compute Engine的啓動腳本將輸出,你可以在雲端控制檯或與gcloud工具在命令行查看串行端口。以下文檔中更詳細解釋如何查看串行端口輸出:

與串行控制檯
https://cloud.google.com/compute/docs/instances/interacting-with-serial-console

(導航到「VM實例」相互作用 - >實例名 - >「串行端口」 - > '連接到串行端口')

gcloud計算實例得到串行端口輸出
https://cloud.google.com/sdk/gcloud/reference/compute/instances/get-serial-port-output

gcloud compute instances get-serial-port-output NAME [--port=PORT] [--zone=ZONE] [GLOBAL-FLAG …] 
相關問題