AWS CLI 命令在 crontab 中不起作用
我有一台 CentOS 7.9 计算机,上面安装了 AWS CLI。我可以成功地单独运行此命令:aws s3sync s3://bucketname /data/bucketname/
,但是当我尝试通过 crontab 运行它时,它不起作用。我在 /var/log/cron
中看到的只是命令已运行,但 /data/bucketname 目录中没有数据。 这就是我的 crontab 的样子:
*/5 * * * * sh /root/script.sh
这就是我的脚本的样子:
#!/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/opt/aws/bin
SHELL=/bin/bash
/bin/aws s3 sync s3://bucketname /data/bucketname/
which aws
返回 /bin/aws
所以我尝试将其添加到我的 script.sh 文件中但这并没有什么区别。任何帮助将不胜感激。
I have a CentOS 7.9 machine with AWS CLI installed on it. I can successfully run this command on its own: aws s3 sync s3://bucketname /data/bucketname/
but when I try to run it via crontab, it doesn't work. All I see in the /var/log/cron
is that the command ran, but there is no data in that /data/bucketname directory.
This is what my crontab looks like:
*/5 * * * * sh /root/script.sh
And this is what my script looks like:
#!/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/opt/aws/bin
SHELL=/bin/bash
/bin/aws s3 sync s3://bucketname /data/bucketname/
which aws
returns /bin/aws
so I tried to add that to my script.sh file but that did not make a difference. Any help would be much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论