免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2764 | 回复: 8
打印 上一主题 下一主题

怎么在shell script里面自动下载一个 web页面的文件?? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-04-08 10:39 |只看该作者 |倒序浏览
20可用积分
用什么命令
在shell script 里面自动下载一个 web页面的文件??下面是web页面上的文件连接
https://192.168.1.147/get_handle ... name=System_log.zip
这个shell script 是运行在这个web 服务器上的。

最佳答案

论坛徽章:
8
摩羯座
日期:2014-11-26 18:59:452015亚冠之浦和红钻
日期:2015-06-23 19:10:532015亚冠之西悉尼流浪者
日期:2015-08-21 08:40:5815-16赛季CBA联赛之山东
日期:2016-01-31 18:25:0515-16赛季CBA联赛之四川
日期:2016-02-16 16:08:30程序设计版块每日发帖之星
日期:2016-06-29 06:20:002017金鸡报晓
日期:2017-01-10 15:19:5615-16赛季CBA联赛之佛山
日期:2017-02-27 20:41:19
2 [报告]
发表于 2008-04-08 10:39 |只看该作者
wget

论坛徽章:
0
3 [报告]
发表于 2008-04-08 10:45 |只看该作者
哦 还好系统里有wget我去试试 谢谢

论坛徽章:
0
4 [报告]
发表于 2008-04-08 10:55 |只看该作者
好像不怎么行
wget https://192.168.1.147/get_handle ... name=System_log.zip
[1] 5094
[2] 5095
[3] 5096
[3]   Done                    OPERATION=set
nas-01-AD-DD:/backup# --10:47:41--  https://192.168.1.147/get_handler?PAGE=Status
           => `get_handler?PAGE=Status'
Connecting to 192.168.1.147:443... connected.
ERROR: Certificate verification error for 192.168.1.147: self signed certificate
To connect to 192.168.1.147 insecurely, use `--no-check-certificate'.
Unable to establish SSL connection.

[1]-  Exit 1                  wget https://192.168.1.147/get_handler?PAGE=Status
[2]+  Done                    command=GetZippedLogs

我用
nas-01-AD-DD:/backup# wget --http-user=admin --http-passwd=netgear1 https://192.168.1.147/get_handler?PAGE=St
atus&command=GetZippedLogs&OPERATION=set&download_file_name=System_log.zip
[1] 5763
[2] 5764
[3] 5765
--10:52:00--  https://192.168.1.147/get_handler?PAGE=Status
           => `get_handler?PAGE=Status'
[2]   Done                    command=GetZippedLogs
[3]   Done                    OPERATION=set

还有这个也不行
wget --http-user=admin --http-passwd=netgear1 --no-check-certificate https://192.168.1.
147/get_handler?PAGE=Status&command=GetZippedLogs&OPERATION=set&download_file_name=System_log.zip
[1] 5930
[2] 5931
[3] 5932
[2]   Done                    command=GetZippedLogs
[3]   Done                    OPERATION=set
--10:52:44--  https://192.168.1.147/get_handler?PAGE=Status
           => `get_handler?PAGE=Status'
nas-01-AD-DD:/backup# Connecting to 192.168.1.147:443... connected.
WARNING: Certificate verification error for 192.168.1.147: self signed certificate
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/xml]

    [ <=>                                                              ] 35            --.--K/s            

10:52:48 (65.60 KB/s) - `get_handler?PAGE=Status' saved [35]
nas-01-AD-DD:/backup# Connecting to 192.168.1.147:443... connected.
ERROR: Certificate verification error for 192.168.1.147: self signed certificate
To connect to 192.168.1.147 insecurely, use `--no-check-certificate'.
Unable to establish SSL connection.

[1]+  Exit 1                  wget --http-user=admin --http-passwd=netgear1 https://192.168.1.147/get_handler?PAGE=Status

论坛徽章:
8
摩羯座
日期:2014-11-26 18:59:452015亚冠之浦和红钻
日期:2015-06-23 19:10:532015亚冠之西悉尼流浪者
日期:2015-08-21 08:40:5815-16赛季CBA联赛之山东
日期:2016-01-31 18:25:0515-16赛季CBA联赛之四川
日期:2016-02-16 16:08:30程序设计版块每日发帖之星
日期:2016-06-29 06:20:002017金鸡报晓
日期:2017-01-10 15:19:5615-16赛季CBA联赛之佛山
日期:2017-02-27 20:41:19
5 [报告]
发表于 2008-04-08 10:57 |只看该作者
"https....................zip"

论坛徽章:
0
6 [报告]
发表于 2008-04-08 11:06 |只看该作者
好像可以了 不怎么用wget 能说一下 怎么存到一个文件夹?? 我查了使用说明 没有说 只能存在本地文件夹??

论坛徽章:
8
摩羯座
日期:2014-11-26 18:59:452015亚冠之浦和红钻
日期:2015-06-23 19:10:532015亚冠之西悉尼流浪者
日期:2015-08-21 08:40:5815-16赛季CBA联赛之山东
日期:2016-01-31 18:25:0515-16赛季CBA联赛之四川
日期:2016-02-16 16:08:30程序设计版块每日发帖之星
日期:2016-06-29 06:20:002017金鸡报晓
日期:2017-01-10 15:19:5615-16赛季CBA联赛之佛山
日期:2017-02-27 20:41:19
7 [报告]
发表于 2008-04-08 11:12 |只看该作者
-O file
       --output-document=file
           The documents will not be written to the appropriate files, but
           all will be concatenated together and written to file.  If file
           already exists, it will be overwritten.  If the file is -, the
           documents will be written to standard output.

论坛徽章:
0
8 [报告]
发表于 2008-04-08 11:16 |只看该作者
哦 谢谢 非常感谢!

论坛徽章:
0
9 [报告]
发表于 2008-04-08 15:29 |只看该作者
原帖由 mjj911 于 2008-4-8 10:55 发表
好像不怎么行
wget https://192.168.1.147/get_handle ... name=System_log.zip
[1] 5094
[2] 5095
[3] 5096
[3]   Done                    ...

把&转义掉就行了。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP