gcloud compute:发出命令并关闭终端

gcloud compute: issue command and close terminal

由于创建 google 计算引擎实例的快照需要时间,我想知道是否可以在我的本地机器上发出 gcloud compute disks snapshot 命令并关闭本地机器上的终端而不中断快照创建过程?

来自documentation for gcloud compute disks snapshot

FLAGS

--async

Display information about the operation in progress, without waiting for the operation to complete.

您可以 运行 gcloud compute disks snapshot --async 并记下操作 ID,然后 运行 gcloud compute operations describe <OPERATION ID> 检查操作(您可能还必须提供操作,应与磁盘的区域相同)。

即使您不使用 --async 标志,该操作也会在后台异步 运行ning(gcloud 只是保持打开状态直到它完成)。如果关闭终端,快照将完成。如果您有兴趣跟进其状态,您只需要进行一些挖掘以找到操作 ID。