gpt4 book ai didi

shell - 如何使用 Google Cloud Shell 安排 shell 脚本?

转载 作者:行者123 更新时间:2023-12-04 16:16:50 26 4
gpt4 key购买 nike

我有一个存储在 GCS 中的 .sh 文件。我正在尝试通过 Google Cloud Shell 安排 .sh 文件。

我可以使用 gsutil cat gs://miptestauto/baby.sh | 运行相同的文件 | sh 命令但无法安排它。

以下是我安排文件的代码:

16 17 * * * gsutil cat gs://miptestauto/baby.sh | sh

它显示消息为“auto saving..done”,但是当我使用 crontab -l

时没有显示计划的作业
# contents of .sh file 
bin/bash
bq load --source_format=CSV babynames.baby_destination13 gs://testauto/yob2010.txt name:string,gender:string,count:integer

谁能告诉我如何使用 google cloud shell 安排它。我没有使用计算引擎/应用引擎。只是想使用云 shell 来安排它。

提前谢谢你:)

最佳答案

根据 the documentation , Cloud Shell 仅供交互使用。 Cloud Shell 实例是基于每个用户、每个 session 进行配置的, session 在闲置一小时后终止。

为了安排每日 cron 作业,实例需要一直启动并运行,但 Cloud Shell 不会发生这种情况,我相信您的作业因此没有运行。

当你开始Cloud Shell ,它提供了一个 f1-micro 实例,它与您可以获得的机器类型相同 for free如果您有资格获得 “Always Free” .因此,您可以创建一个 f1-micro 实例,在其上配置 cron 作业并使其保持运行状态,以便它可以执行日常作业。

您可以在 https://cloud.google.com/compute/pricing#freeusage 查看免费使用限制

关于shell - 如何使用 Google Cloud Shell 安排 shell 脚本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47035014/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com