Cronjob 不在 Google Compute Engine 上 运行

Cronjob doesn't run on Google Compute Engine

我在 Google Cloud 的计算引擎上的一个实例中设置了一个 cron 作业。

假设每天7:47am运行。但是,每次我检查文件是否已在 7:48 处执行时,它都不起作用。

helloworld.sh 文件的代码在这里

echo "helloworld" + "$(date)" > helloworld.txt

我已将检查设置为 root 并将 cron 作业设置为 root 仍然没有。有什么想法吗?

cron 作业错误,因为您需要在命令中使用绝对路径。尝试:

/bin/bash /home/username/helloworld.sh