好文档 - 专业文书写作范文服务资料分享网站

Linux平台自动下载FTP服务器数据的实现

天下 分享 时间: 加入收藏 我要投稿 点赞

龙源期刊网 http://www.qikan.com.cn

Linux平台自动下载FTP服务器数据的实现

作者:聂林波

来源:《电脑知识与技术》2016年第30期

摘要:针对Linux环境下自动下载FTP服务器数据文件需要,提出用shell脚本程序实现数据自动下载功能。该方法将Linux系统的crontab命令、date命令、shell脚本和wget软件有机结合实现FTP数据的自动下载。Linux系统能定时自动运行shell脚本调用wget软件自动下载数据文件。在Linux系统下灵活组合各种命令能够低成本实现复杂功能。 关键词:Linux;crontab;shell;wget;定时;下载

中图分类号:TP316 文献标识码:A 文章编号:1009-3044(2016)30-0248-01 The Method to Download Files Automatically Form FTP Website on Linux System NIE Lin-bo

(The Ocean Meteorological and Hydrological Center of South China Sea Fleet, Zhanjiang 524001, China)

Abstract: to fulfill the need of download data file from FTP server automatically, the method was proposed which can download file at regular time everyday using shell scripts. The method combined crontab, date, shell scripts and wget command to realize the task of downloading file automatically. Linux can run shell scripts to download file on FTP server at regular time. The complicated function can be realized by combining a sort of commands organically. Key words: Linux; crontab; shell; wget; timing; download 1 需求的提出

在工作中遇到这样的情况,需要从FTP网站自动下载数据文件。这些文件每天会自动产生并保存在按日期建立的文件夹中,文件名包含有日期等信息。每天生成的文件数以百计。如果手工下载,效率很低。考虑到这些特点,必须采用软件自动下载。 2 实现的方法

在Linux下有个软件wget可以实现从网站下载文件。要实现自动下载,最经济的方法是使用crontab命令定时执行wget命令即可无需人工干预自动运行。要使wget能根据日期变化自动改变下载目录和文件名,就需要编写shell脚本来实现。Shell脚本自动根据当前时间产生需要的日期和时间参数,wget利用这些参数下载相应的数据文件。

Linux平台自动下载FTP服务器数据的实现

龙源期刊网http://www.qikan.com.cnLinux平台自动下载FTP服务器数据的实现作者:聂林波来源:《电脑知识与技术》2016年第30期摘要:针对Linux环境下自动下载FTP服务器数据文件需要,提出用shell脚本程序实现数据自动下载功能。该方法将Linux系统的crontab命令、date
推荐度:
点击下载文档文档为doc格式
3kjcq2ik063sk4u09qt56trx01723y00exc
领取福利

微信扫码领取福利

微信扫码分享