首页 > 解决方案 > 从 shell 脚本运行 gcloud?

问题描述

我需要每天两次调整 Google Cloud Run 容器的设置。(特别是:调整最小实例的数量以平衡性能和成本)

所以我正在尝试编写一个 shell 脚本,然后在每天的特定时间执行该脚本(Mac OS 环境)。

在终端中,这个命令对我来说很好:

gcloud run services update [my-containers-name-here] --min-instances 0

但是当我尝试在 shell 脚本(allow-idle.command)中运行它时,它失败了:

do shell script "gcloud run services update [my-containers-name-here] --min-instances 0"

我尝试运行 shell 脚本时收到的错误是

找不到命令:gcloud

我哪里错了?

标签: bashshellzshgcloudgoogle-cloud-run

解决方案


推荐阅读