本頁面中的部分或全部資訊可能不適用於 Trusted Cloud by S3NS。
關於開機指令碼
開機指令碼是包含指令的檔案,會在虛擬機器 (VM) 執行個體啟動時執行。Compute Engine 支援在 Linux VM 和 Windows VM 上執行啟動指令碼。
下表提供說明文件的連結,說明如何使用啟動指令碼。
開機指令碼工作 |
最適用 |
連結至程序 |
直接傳遞開機指令碼 |
指令碼大小上限為 256 KB |
|
從本機檔案傳送開機指令碼 |
指令碼大小上限為 256 KB |
|
從 Cloud Storage 傳遞開機指令碼 |
超過 256 KB 的指令碼 |
|
從開機指令碼存取中繼資料 |
將不同值傳遞至使用相同指令碼的每個 VM |
|
重新執行開機指令碼 |
執行指令碼,不必重新啟動 VM |
|
查看開機指令碼的輸出內容 |
監控指令碼進度 |
|
後續步驟
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-08 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-08-08 (世界標準時間)。"],[[["Startup scripts are files containing commands that execute upon the boot of a virtual machine (VM) instance, supported by both Linux and Windows VMs."],["Startup scripts can be passed directly, from a local file, or from Cloud Storage, depending on the script's size, with direct and local files limited to 256 KB, and Cloud Storage for larger scripts."],["You can use startup scripts to pass different values to each VM via metadata."],["You can rerun a startup script without having to restart the VM."],["There is documentation to describe how to monitor the progress of a script when it is running, and also how to add a shutdown script."]]],[]]