繁体   English   中英

将文件从S3中复制到Ubuntu 18.04中的临时文件夹的计划过程

[英]Scheduled process to copy files out of S3 into a temp-folder in Ubuntu 18.04

在以下情况下寻找建议:

在ubuntu 18.04服务器中,每隔1分钟检查一次AWS S3存储桶中的新文件,一天结束时仅将最新文件提取到temp文件夹中。

它应该在bash中自动执行。

我建议使用aws s3事件通知,队列,lambda,但定义它最好是使其保持简单。

我正在寻找以下步骤的建议:

对于步骤1,我正在做aws s3 ls | awk (FUNCTION to filter files updated within the last minute) aws s3 ls | awk (FUNCTION to filter files updated within the last minute)然后我意识到最好使用grep

 0-Cron job should run from 7:00 to 23:00 every minute 1-List the files updated to S3 bucket during the past 1 minute 2-List the files in a temp-encrypted folder in ubuntu 18.03 3-Are the files listed in step 1 already downloaded in folder temp-encrypted from step 2 4-If the files are not already donloaded > download newest files from S3 bucket into temp-encrypted 5-At end of the day 23:00 take a record of the last files fetched from s3 6-run cleanup script at end of the day to remove everything in temp-encrypted 

我附上一张带有预期流程和基础架构设计的图表。 预期的过程

解决方案是这样的:

  1. 将FTPS更改为在Ubuntu 18.04中运行的SFTP
  2. 更改主要端口:SSH的randomport1和SFTP的randomport2
  3. 在sshd_config文件中配置SFTP
  4. 一旦一切正常,创建本地目录结构
  5. 通过使用bash脚本

5.1列出S3中的内容并保存在var中

5.2对于s3中列出的每个文件,检查本地目录s3-mirror中的镜像文件中是否没有新文件

5.3如果有新的文件获取,请在s3-mirror目录中触摸一个包含empy内容的文件,其名称相同,将加密的文件移至SFTP并从镜像的本地目录中删除获取的S3文件

5.4在日志中记录成功的操作。

到目前为止,效果很好。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM