无法使用CRON将文件从服务器上传到S3存储桶

发布于 2025-02-02 18:35:42 字数 600 浏览 1 评论 0原文

下午好,您能把明智的眼睛和大脑在这个问题上投下吗?我应该使用AWS CLI设置一个计划上传的上传,以便我创建的CRON作业文件,也将发送到S3(每小时),也更早创建。现在,我已经使用了本指南,创建的脚本文件如下所示,其中本地文件夹路径是我的cron作业文件所在的位置,而存储桶名是我创建的(已通过CLI使用基本命令创建,尚未添加任何权限或策略)。这被保存为脚本。 >

有人可以建议我在哪里做嘘吗?它不是完全配置的S3吗?是否不正确地命名和/或将FIELS放置在服务器上的目录中?应该将第一个文件发送到S3的CRON作业是0 */1 * * */path to-script-file.script.sh

非常感谢您的帮助,我真的会喜欢正确地理解这里发生的事情。

脚本文件包含:

#!/bin/bash
aws s3 cp /local-folder-path/  s3://bucket-name

Good afternoon, can you cast your wise eyes and brains on this issue. I'm supposed to set up a scheduled upload using AWS CLI so that cron job file that I have created, gets sent to s3 (every hour), also created earlier. Now, I have used this guide, created script file as per below, where local folder path is where my cron job file is sitting and bucket-name is my bucket created (has been created via CLI with basic command, have not added any permissions or policies). This was saved as script.sh and since creating it, I have received 2 mails to my ec2-user with main error saying /bin/sh: /home/ec2-user/script.sh: Permission denied

Can someone advise on where am I making boo boo? Is it not fully configured S3? Is it incorrect naming and/or placing of the fiels in the directories on the server? Cron job that is supposed to be sending first file to s3 is 0 */1 * * * /path-to-script-file.script.sh

Thank you very much for the help, I would really like to get this right and understand what is happening here.

Script file contains:

#!/bin/bash
aws s3 cp /local-folder-path/  s3://bucket-name

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

绮烟 2025-02-09 18:35:42

确保将脚本运行为ec2-user,并且不要忘记chmod 755 Path/to/to/your/script it。

另外,您应该在ec2-user下运行cron - 使用

sudo -u ec2-user crontab -e t

并尝试重新运行脚本。

最后,确保您的EC2具有正确的作用,可以写给S3。

Make sure you're running the script as ec2-user and don't forget to chmod 755 PATH/TO/YOUR/SCRIPT it.

Also, you should run the cron under ec2-user - use

sudo -u ec2-user crontab -e t

And try re-running the script.

Finally, make sure that your EC2 has the right role to write to S3.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文