本页面上的部分或全部信息可能不适用于 Trusted Cloud by S3NS。
启动脚本简介
启动脚本是一个文件,其中包含在虚拟机 (VM) 实例启动时运行的命令。Compute Engine 支持在 Linux 虚拟机和 Windows 虚拟机上运行启动脚本。
下表包含介绍如何使用启动脚本的文档的链接。
启动脚本任务 |
最佳用途 |
过程链接 |
直接传递启动脚本 |
脚本大小上限:256 KB |
|
从本地文件传递启动脚本 |
脚本大小上限:256 KB |
|
从 Cloud Storage 传递启动脚本 |
大于 256 KB 的脚本 |
|
从启动脚本访问元数据 |
向使用相同脚本的每个虚拟机传递不同的值 |
|
重新运行启动脚本 |
在不重启虚拟机的情况下运行脚本 |
|
查看启动脚本的输出 |
监控脚本的进度 |
|
后续步骤
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-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"]],["最后更新时间 (UTC):2025-07-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."]]],[]]