mac cron 无法正确使用 shell

mac cron 无法正确使用 shell

我已经设置了 cron 来运行一个简单的 hello world shell 脚本,但它给出了一个错误,而 Google 无法帮助我解决。我肯定错过了一些非常简单的东西!

这是我的 crontab:

[email protected]
SHELL=/bin/bash
30 * * * * * $HOME/hello.sh

这是 hello.sh:

#!/bin/bash                                                                                       
echo HELLO WORLD!

我收到此错误电子邮件:

/bin/bash: 555: command not found

我尝试过将 shell 设置为,/bin/sh但没有什么效果。我仍然收到类似的错误消息。

答案1

cron 需要 5 个参数来计时。您给出了 6 个(30加 5 *),因此它使用第六个参数来获取命令名称。

相关内容