<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title>RH MAN (Realistic Honest MAN!)</title> 
<link>http://5iwww.vicp.net/index.php</link> 
<description>游荡网络十余年,才发现自己想要的,不过是那一片小小的私人空间,欢迎您的到来,分享我的快乐和忧愁~ </description> 
<language>zh-cn</language> 
<copyright>Powered by Bo-blog 2.0.2 sp2</copyright>
<item>
<link>http://5iwww.vicp.net/read.php?1069</link>
<title>rhel5 iscsi 应用（windows客户端）</title> 
<author>井宿 &lt;wanjun@5iwww.com&gt;</author>
<category>技术文档</category>
<pubDate>Tue,  9 Jun 2009 02:29:27 +0000</pubDate> 
<guid>http://5iwww.vicp.net/read.php?1069</guid> 
<description>
<![CDATA[ 
	本文将使用RedHat Enterprise Linux5.1系统分别建立基于LinuxIscsi应用示例，帮助大家理解Iscsi以及SAN对于企业应用服务器部署的意义。<br/>1、安装LinuxIscsi服务器端<br/>在安装好RedHat Enterprise Linux5.1主机上为了增强数据的安全性和完整性、服务器网络连接的高可用性及吞吐量我们使用SoftwareRAID建立RAID10盘阵并使用bonding实现双网卡负载均衡（详细创建过程请参考相关资料），以下信息是建好RAID10盘阵并使用bonding实现双网卡负载均衡后查看到的系统信息：<br/>1、盘阵信息可以通过查看/proc/mdstat文件获得：<br/>在[root@akczftp ~]#处输入命令 cat /proc/mdstat<br/>系统返回如下信息：<br/>Personalities : [raid1] [raid0]<br/>md3 : active raid0 md0[0] md2[2] md1[1]<br/> &nbsp; &nbsp; &nbsp;234443904 blocks 128k chunks<br/><br/>md2 : active raid1 sdf1[0] sdg1[1]<br/> &nbsp; &nbsp; &nbsp;78148096 blocks [2/2] [UU]<br/><br/>md1 : active raid1 sdd1[0] sde1[1]<br/> &nbsp; &nbsp; &nbsp;78148096 blocks [2/2] [UU]<br/><br/>md0 : active raid1 sdb1[0] sdc1[1]<br/> &nbsp; &nbsp; &nbsp;78148096 blocks [2/2] [UU]<br/>unused devices: <none><br/>我们可以看到RAID10盘阵组成以及盘阵工作状态。<br/>2、Bonding信息可以通过查看/proc/net/bonding/bond0文件获得：<br/>在[root@akczftp ~]#处输入命令 cat /proc/net/bonding/bond0<br/>系统返回如下信息：<br/>Ethernet Channel Bonding Driver: v3.1.2 (January 20, 2007)<br/><br/>Bonding Mode: load balancing (round-robin)<br/>MII Status: up<br/>MII Polling Interval (ms): 100<br/>Up Delay (ms): 0<br/>Down Delay (ms): 0<br/><br/>Slave Interface: eth0<br/>MII Status: up<br/>Link Failure Count: 0<br/>Permanent HW addr: 00:11:25:65:1f:38<br/><br/>Slave Interface: eth1<br/>MII Status: up<br/>Link Failure Count: 0<br/>Permanent HW addr: 00:e0:8c:fc:ba:0e<br/>在此基础上我们将安装LinuxIscsi服务器需要的服务器端软件iscsitarget，该软件可以从http//iscsitarget.sourceforge.net/进行下载，目前最新版本是0.4.16,下载完后在本地下载保存目录中应该出现iscsitarget-0.4.16.tar.gz文件，注意：安装要2.6.14以上内核。在[root@akczftp opt]# uname –a<br/>系统返回如下信息：<br/>Linux akczftp.xatlj 2.6.21-1.3194.fc7 #1 SMP Wed May 23 22:35:01 EDT 2007 i686 i686 i386 GNU/Linux<br/>2.6.21-1.3194.fc7即为该系统Linux内核（Kernel）版本。<br/>Iscsitarget具体安装步逐如下：<br/>1、在[root@akczftp opt]#处输入命令tar -zxf iscsitarget-0.4.15.tar.gz //解压该tar包<br/>2、在[root@akczftp opt]#处输入命令cd iscsitarget-0.4.16 //进入解压后生成的安装文件目录<br/>3、依次在[root@akczftp iscsitarget-0.4.16]#处输入以下命令<br/>make<br/>make kernel<br/>make usr<br/>make KSRC=/usr/src/kernels/2.6.21-1.3194.fc7-i686/ install-man<br/>make KSRC=/usr/src/kernels/2.6.21-1.3194.fc7-i686/ install-kernel<br/>make KSRC=/usr/src/kernels/2.6.21-1.3194.fc7-i686/ install-usr<br/>make KSRC=/usr/src/kernels/2.6.21-1.3194.fc7-i686/ install-init<br/>make KSRC=/usr/src/kernels/2.6.21-1.3194.fc7-i686/ install-etc<br/>chkconfig --add iscsi-target<br/>4、在[root@akczftp opt]#处输入命令vi /etc/ietd.conf对/etc/ietd.conf文件进行配置，以下内容是我的配置实例<br/>Target iqn.2008-04.xatlj.akczftp:storage.disk2.sys1.xyz<br/> &nbsp; &nbsp; &nbsp; &nbsp;# Users, who can access this target. The same rules as for discovery<br/> &nbsp; &nbsp; &nbsp; &nbsp;# users apply here.<br/> &nbsp; &nbsp; &nbsp; &nbsp;# Leave them alone if you don't want to use authentication.<br/> &nbsp; &nbsp; &nbsp; &nbsp;#IncomingUser joe secret<br/> &nbsp; &nbsp; &nbsp; &nbsp;#OutgoingUser jim 12charpasswd<br/> &nbsp; &nbsp; &nbsp; &nbsp;# Logical Unit definition<br/> &nbsp; &nbsp; &nbsp; &nbsp;# You must define one logical unit at least.<br/> &nbsp; &nbsp; &nbsp; &nbsp;# Block devices, regular files, LVM, and RAID can be offered<br/> &nbsp; &nbsp; &nbsp; &nbsp;# to the initiators as a block device.<br/> &nbsp; &nbsp; &nbsp; &nbsp;Lun 0 Path=/dev/md3,Type=fileio<br/> &nbsp; &nbsp; &nbsp; &nbsp;Alias iDISK0<br/> &nbsp; &nbsp; &nbsp; &nbsp;# Alias Test<br/> &nbsp; &nbsp; &nbsp; &nbsp;# various iSCSI parameters<br/> &nbsp; &nbsp; &nbsp; &nbsp;# (not all are used right now, see also iSCSI spec for details)<br/> &nbsp; &nbsp; &nbsp; &nbsp;#MaxConnections &nbsp; &nbsp; &nbsp; &nbsp; 1<br/> &nbsp; &nbsp; &nbsp; &nbsp;#InitialR2T &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Yes<br/> &nbsp; &nbsp; &nbsp; &nbsp;#ImmediateData &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;No<br/> &nbsp; &nbsp; &nbsp; &nbsp;#MaxRecvDataSegmentLength 8192<br/> &nbsp; &nbsp; &nbsp; &nbsp;#MaxXmitDataSegmentLength 8192<br/> &nbsp; &nbsp; &nbsp; &nbsp;#MaxBurstLength &nbsp; &nbsp; &nbsp; &nbsp; 262144<br/> &nbsp; &nbsp; &nbsp; &nbsp;#FirstBurstLength &nbsp; &nbsp; &nbsp; 65536<br/> &nbsp; &nbsp; &nbsp; &nbsp;#DefaultTime2Wait &nbsp; &nbsp; &nbsp; 2<br/> &nbsp; &nbsp; &nbsp; &nbsp;#DefaultTime2Retain &nbsp; &nbsp; 20<br/> &nbsp; &nbsp; &nbsp; &nbsp;#MaxOutstandingR2T &nbsp; &nbsp; &nbsp;8<br/> &nbsp; &nbsp; &nbsp; &nbsp;#DataPDUInOrder &nbsp; &nbsp; &nbsp; &nbsp; Yes<br/> &nbsp; &nbsp; &nbsp; &nbsp;#DataSequenceInOrder &nbsp; &nbsp;Yes<br/> &nbsp; &nbsp; &nbsp; &nbsp;#ErrorRecoveryLevel &nbsp; &nbsp; 0<br/> &nbsp; &nbsp; &nbsp; &nbsp;#HeaderDigest &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CRC32C,None<br/> &nbsp; &nbsp; &nbsp; &nbsp;#DataDigest &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CRC32C,None<br/> &nbsp; &nbsp; &nbsp; &nbsp;# various target parameters<br/> &nbsp; &nbsp; &nbsp; &nbsp;#Wthreads &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 8<br/>上面这一行中的“Target iqn.2008-04.xatlj.akczftp:storage.disk2.sys1.xyz<br/>”这是 Target 名称，称作‘iSCSI Qualified Name'（简称：iqn），这格式在 iSCSI 规格书中有详细说明<br/>iqn.yyyy-mm.<reversed domain name>[:identifier]<br/>格式 意义 范例<br/>yyyy-mm 年份-月份 2008-04<br/>reversed domain name 倒过来的网域名称 xatlj.akczftp<br/>identifier 识别代号 storage.disk2.sys1.xyz<br/>LUN（Logical Unit Number），“#Lun 0 Path=/dev/md3,Type=fileio”这一行中， Path 改成您提供的硬盘名称，此例为“Path=/dev/md3”。我们可以使用像是区块装置（Block devices，例 /dev/sdc）、一般档案（regular files）、LVM 逻辑卷轴（Logical Volume）与磁碟阵列（RAID）提供给 Initiators 主机当做‘区块装置’（硬盘）。<br/>5、在[root@akczftp etc]#处输入/etc/init.d/iscsi-target start启动iscsi-target服务。<br/>6、在[root@akczftp etc]# 处输入cat /proc/net/iet/volume命令检查启动后的iscsi-target，如果系统返回如下信息<br/>tid:1 name:iqn.2008-04.xatlj.akczftp:storage.disk2.sys1.xyz<br/> &nbsp; &nbsp; &nbsp; &nbsp;lun:0 state:0 iotype:fileio iomode:wt path:/dev/md3<br/>说明iscsi-target服务已经正常工作。<br/>到此Iscsitarget服务器安装工作结束，下面将进行客户端程序的安装配置<br/>2、安装配置Iscsi客户端<br/>Iscsi客户端程序可以部署在Linux机器上，也可以部署在Windows机器上，或者由他们来共同使用Iscsi服务器提供的“存储设备”，下面我们就分别对Linux和Windows的Iscsi客户端进行配置<br/>1、安装配置LinuxIscsi客户端<br/>在RHEL5.1系统中, 生成并查看Iscsi启动器的名称<br/>在[root@akczdns etc]#处输入命令<br/>echo "InitiatorName=`iscsi-iname`" > /etc/iscsi/initiatorname.iscsi<br/>在[root@akczdns etc]#处输入命令<br/>cat /etc/iscsi/initiatorname.iscsi，系统返回如下信息<br/>InitiatorName=iqn.2005-03.com.redhat:01.9fd8e65dd7f8<br/>在RHEL5.1系统中, 配置iSCSI启动器服务<br/>在[root@akczdns etc]#处输入命令 vi /etc/iscsi/iscsid.conf (iSCSI启动器服务的配置文件,按照具体情况修改相关行内容)<br/>node.startup = automatic<br/>node.session.auth.authmethod = CHAP<br/>node.session.auth.username = iqn.2005-03.com.redhat:01.9fd8e65dd7f8<br/>node.session.auth.password = 01.9fd8e65dd7f8<br/>在[root@akczdns etc]#处输入命令chkconfig iscsi --level 35 on<br/>在Storbridge系统中, 创建并分配一个iSCSI共享<br/>通过共享管理-iSCSI共享, 使用iSCSI共享虚拟磁盘创建一个iSCSI共享;<br/>根据第3步得到的iSCSI启动器的名称, 使用CHAP认证模式进行分配;<br/>启动器名称: iqn.2005-03.com.redhat:01.9fd8e65dd7f8<br/>启动器口令: 01.9fd8e65dd7f8<br/>在RHEL5系统中, 启动iSCSI启动器服务<br/>在[root@akczdns etc]#处输入命令service iscsi start<br/>在RHEL5系统中, 使用iSCSI存储<br/>在[root@akczdns etc]#处输入命令rm -rf /var/lib/iscsi/nodes/*<br/>在[root@akczdns etc]#处输入命令rm -rf /var/lib/iscsi/send_targets/*<br/>在[root@akczdns etc]#处输入命令iscsiadm -m discovery -t st -p 10.109.1.59 (发现)<br/>10.109.1.59:3260,1 iqn.2008-04.xatlj.akczftp:storage.disk2.sys1.xyz<br/>在[root@akczdns etc]#处输入命令iscsiadm -m node -T iqn.2001-04.xatlj.akczftp:storage.disk2.sys1.xyz -p 10.109.1.59 -l (登录)<br/>在[root@akczdns etc]#处输入命令sfdisk -s<br/>/dev/rd/c0d0: &nbsp;71802880<br/>/dev/sda: 234443904<br/>total: 306246784 blocks<br/>其中/dev/sda就是我们的Iscsi存储设备<br/>这样我们就可以象使用本地磁盘那样对它进行分区、格式化等操作，这里不再阐述。<br/>2、安装配置WindowsIscsi客户端<br/>微软建议, iSCSI软件启动器的运行环境<br/>Windows Server 2003 SP1 or higher<br/>Windows 2000 with the latest service pack/security pack<br/>Windows XP SP2 or higher<br/>在Win2000系统中, 下载并安装最新的微软iSCSI软件启动器<br/>在Win2000系统中, 查看iSCSI启动器的名称<br/><br/>在Storbridge系统中, 创建并分配一个iSCSI共享<br/>通过共享管理-iSCSI共享, 使用iSCSI共享虚拟磁盘创建一个iSCSI共享;<br/>根据第3步得到的iSCSI启动器的名称, 使用CHAP认证模式进行分配; (设置CHAP认证, 目标器端)<br/>启动器名称: iqn.1991-05.com.microsoft:akczdsz.xatlj<br/>启动器口令: akczdsz.xatlj<br/>在Win2000系统中, 发现iSCSI目标器<br/><br/>点击Target Portals的Add, 输入Storbridge系统的IP地址<br/><br/>点击OK, 回到iSCSI Initiator属性的对话框, 验证Target Portals中的内容<br/><br/>在Win2000系统中, 察看和登录iSCSI目标器<br/><br/>点击Log On<br/><br/>选中Automatically restore this connection when the system boots<br/>点击Advanced, 选择Local Adapter,Source IP和Target Portal<br/>选中CHAP logon information, 根据第3步设置填写CHAP认证信息<br/><br/>点击确定, 回到Log On to Target的对话框<br/>再点击OK, 回到iSCSI Initiator属性的对话框, 验证目标器的状态是否为Connected<br/><br/>在Win2000系统中, 初始化iSCSI设备<br/>计算机管理-磁盘管理<br/><br/>点击取消<br/><br/>右击磁盘1, 选择签名<br/><br/>点击确定, 回到磁盘管理的界面<br/><br/>右击磁盘1的未指派区域, 选择创建磁盘分区<br/><br/>点击下一步, 选择主磁盘分区, 指定分区大小, 指派驱动器号, 使用NTFS快速格式化分区<br/><br/>重启系统, 察看iSCSI设备<br/>双击我的电脑<br/><br/>双击本地磁盘(E<br/><br/>如果需要在iSCSI设备上运行自动启动的服务, 如LanManServer（文件共享）<br/>iscsicli BindPersistentVolumes<br/><br/>sc config LanManServer depend= MSiSCSI（Win2000系统中, 请下载sc并放到system32目录中）<br/><br/>通过以上内容，我们已经使用LinuxIscsi建立的ISCSI服务部署了一个简单的储存区域网，在此之后，我们还可以将ISCSI服务器部署在HA、集群应用等需要共享盘阵的更高级应用部署中作为快速的、有效的、安全的、健壮存储设备来使用。<br/>Tags - <a href="http://5iwww.vicp.net/tag.php?tag=rhel5" rel="tag">rhel5</a> , <a href="http://5iwww.vicp.net/tag.php?tag=iscsi" rel="tag">iscsi</a>
  ]]> 
</description>
</item><item>
<link>http://5iwww.vicp.net/read.php?1068</link>
<title>curl使用简介</title> 
<author>井宿 &lt;wanjun@5iwww.com&gt;</author>
<category>技术文档</category>
<pubDate>Tue,  9 Jun 2009 02:00:56 +0000</pubDate> 
<guid>http://5iwww.vicp.net/read.php?1068</guid> 
<description>
<![CDATA[ 
	Curl是一个很强大的http命令行工具，其功能十分强大。<br/>1) 二话不说，先从这里开始吧！<br/>$ curl <a href="http://www.yahoo.com" target="_blank">http://www.yahoo.com</a><br/>回车之后，<a href="http://www.yahoo.com" target="_blank">www.yahoo.com</a> 的html就稀里哗啦地显示在屏幕上了 &nbsp; &nbsp;~<br/>2) 嗯，要想把读过来页面存下来，是不是要这样呢？<br/>$ curl <a href="http://www.yahoo.com" target="_blank">http://www.yahoo.com</a> > page.html<br/>当然可以，但不用这么麻烦的！<br/>用curl的内置option就好，存下http的结果，用这个option: -o<br/>$ curl -o page.html <a href="http://www.yahoo.com" target="_blank">http://www.yahoo.com</a><br/>这样，你就可以看到屏幕上出现一个下载页面进度指示。等进展到100%，自然就 OK咯<br/>3) 什么什么？！访问不到？肯定是你的proxy没有设定了。<br/>使用curl的时候，用这个option可以指定http访问所使用的proxy服务器及其端口： -x<br/>$ curl -x 123.45.67.89:1080 -o page.html <a href="http://www.yahoo.com" target="_blank">http://www.yahoo.com</a><br/>4) 访问有些网站的时候比较讨厌，他使用cookie来记录session信息。<br/>像IE/NN这样的浏览器，当然可以轻易处理cookie信息，但我们的curl呢？.....<br/>我们来学习这个option: -D <— 这个是把http的response里面的cookie信息存到一个特别的文件中去<br/>$ curl -x 123.45.67.89:1080 -o page.html -D cookie0001.txt <a href="http://www.yahoo.com" target="_blank">http://www.yahoo.com</a><br/>这样，当页面被存到page.html的同时，cookie信息也被存到了cookie0001.txt里面了<br/>5）那么，下一次访问的时候，如何继续使用上次留下的cookie信息呢？要知道，很多网站都是靠监视你的cookie信息，来判断你是不是不按规矩访问他们的网站的。<br/>这次我们使用这个option来把上次的cookie信息追加到http request里面去： -b<br/>$ curl -x 123.45.67.89:1080 -o page1.html -D cookie0002.txt -b cookie0001.txt <a href="http://www.yahoo.com" target="_blank">http://www.yahoo.com</a><br/>这样，我们就可以几乎模拟所有的IE操作，去访问网页了！<br/>6）稍微等等 &nbsp; &nbsp;~我好像忘记什么了 &nbsp; &nbsp;~<br/>对了！是浏览器信息 &nbsp;<br/>有些讨厌的网站总要我们使用某些特定的浏览器去访问他们，有时候更过分的是，还要使用某些特定的版本 &nbsp; &nbsp; NND，哪里有时间为了它去找这些怪异的浏览器呢！？<br/>好在curl给我们提供了一个有用的option，可以让我们随意指定自己这次访问所宣称的自己的浏览器信息： -A<br/>$ curl -A "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)" -x 123.45.67.89:1080 -o page.html -D cookie0001.txt <a href="http://www.yahoo.com" target="_blank">http://www.yahoo.com</a><br/>这样，服务器端接到访问的要求，会认为你是一个运行在Windows 2000上的 IE6.0，嘿嘿嘿，其实也许你用的是苹果机呢！<br/>而"Mozilla/4.73 [en] (X11; U; Linux 2.2; 15 i686"则可以告诉对方你是一台 PC上跑着的Linux，用的是Netscape 4.73，呵呵呵<br/>7）另外一个服务器端常用的限制方法，就是检查http访问的referer。比如你先访问首页，再访问里面所指定的下载页，这第二次访问的 referer地址就是第一次访问成功后的页面地址。这样，服务器端只要发现对下载页面某次访问的referer地址不是首页的地址，就可以断定那是个盗连了 &nbsp; &nbsp;~<br/>讨厌讨厌 ~我就是要盗连 &nbsp; &nbsp;~！！<br/>幸好curl给我们提供了设定referer的option： -e<br/>$ curl -A "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)" -x 123.45.67.89:1080 -e "mail.yahoo.com" -o page.html -D cookie0001.txt <a href="http://www.yahoo.com" target="_blank">http://www.yahoo.com</a><br/>这样，就可以骗对方的服务器，你是从mail.yahoo.com点击某个链接过来的了，呵呵呵<br/>8）写着写着发现漏掉什么重要的东西了！——- 利用curl 下载文件<br/>刚才讲过了，下载页面到一个文件里，可以使用 -o ，下载文件也是一样。比如， <br/>$ curl -o 1.jpg <a href="http://cgi2.tky.3web.ne.jp/~zzh/screen1.JPG" target="_blank">http://cgi2.tky.3web.ne.jp...</a><br/>这里教大家一个新的option： -O 大写的O，这么用： <br/>$ curl -O <a href="http://cgi2.tky.3web.ne.jp/~zzh/screen1.JPG" target="_blank">http://cgi2.tky.3web.ne.jp...</a><br/>这样，就可以按照服务器上的文件名，自动存在本地了！ <br/>再来一个更好用的。<br/>如果screen1.JPG以外还有screen2.JPG、screen3.JPG、....、screen10.JPG需要下载，难不成还要让我们写一个script来完成这些操作？<br/>不干！<br/>在curl里面，这么写就可以了：<br/>$ curl -O <a href="http://cgi2.tky.3web.ne.jp/~zzh/screen" target="_blank">http://cgi2.tky.3web.ne.jp...</a>[1-10].JPG<br/>呵呵呵，厉害吧？！ ~<br/>9）再来，我们继续讲解下载！<br/>$ curl -O <a href="http://cgi2.tky.3web.ne.jp/~" target="_blank">http://cgi2.tky.3web.ne.jp...</a>{zzh,nick}/[001-201].JPG<br/>这样产生的下载，就是<br/>~zzh/001.JPG<br/>~zzh/002.JPG<br/>...<br/>~zzh/201.JPG<br/>~nick/001.JPG<br/>~nick/002.JPG<br/>...<br/>~nick/201.JPG<br/>够方便的了吧？哈哈哈<br/>咦？高兴得太早了。<br/>由于zzh/nick下的文件名都是001，002...，201，下载下来的文件重名，后面的把前面的文件都给覆盖掉了 ~<br/>没关系，我们还有更狠的！<br/>$ curl -o #2_#1.jpg <a href="http://cgi2.tky.3web.ne.jp/~" target="_blank">http://cgi2.tky.3web.ne.jp...</a>{zzh,nick}/[001-201].JPG<br/>—这是.....自定义文件名的下载？ —对头，呵呵！<br/>这样，自定义出来下载下来的文件名，就变成了这样：原来： ~zzh/001.JPG —-> 下载后： 001-zzh.JPG 原来： ~nick/001.JPG —-> 下载后： 001-nick.JPG<br/>这样一来，就不怕文件重名啦，呵呵<br/>9）继续讲下载<br/>我们平时在windows平台上，flashget这样的工具可以帮我们分块并行下载，还可以断线续传。curl在这些方面也不输给谁，嘿嘿<br/>比如我们下载screen1.JPG中，突然掉线了，我们就可以这样开始续传<br/>$ curl -c -O <a href="http://cgi2.tky.3wb.ne.jp/~zzh/screen1.JPG" target="_blank">http://cgi2.tky.3wb.ne.jp/...</a><br/>当然，你不要拿个flashget下载了一半的文件来糊弄我 &nbsp; &nbsp;别的下载软件的半截文件可不一定能用哦 ~<br/>分块下载，我们使用这个option就可以了： -r<br/>举例说明<br/>比如我们有一个<a href="http://cgi2.tky.3web.ne.jp/~zzh/zhao1.mp3" target="_blank">http://cgi2.tky.3web.ne.jp...</a> 要下载（赵老师的电话朗诵 :D ）我们就可以用这样的命令：<br/>$ curl -r 0-10240 -o "zhao.part1" http:/cgi2.tky.3web.ne.jp/~zzh/zhao1.mp3 &&#92;<br/>$ curl -r 10241-20480 -o "zhao.part1" http:/cgi2.tky.3web.ne.jp/~zzh/zhao1.mp3 &&#92;<br/>$ curl -r 20481-40960 -o "zhao.part1" http:/cgi2.tky.3web.ne.jp/~zzh/zhao1.mp3 &&#92;<br/>$ curl -r 40961- -o "zhao.part1" http:/cgi2.tky.3web.ne.jp/~zzh/zhao1.mp3<br/>这样就可以分块下载啦。不过你需要自己把这些破碎的文件合并起来如果你用UNIX或苹果，用 cat zhao.part* > zhao.mp3就可以如果用的是Windows，用copy /b 来解决吧，呵呵<br/>上面讲的都是http协议的下载，其实ftp也一样可以用。用法嘛，<br/>$ curl -u name:passwd <a href="ftp://ip:port/path/file" target="_blank">ftp://ip:port/path/file</a><br/>或者大家熟悉的<br/>$ curl <a href="ftp://name:passwd@ip:port/path/file" target="_blank">ftp://name:passwd@ip:port/...</a><br/>10) 说完了下载，接下来自然该讲上传咯上传的option是 -T<br/>比如我们向ftp传一个文件：<br/>$ curl -T localfile -u name:passwd <a href="ftp://upload_site:port/path/" target="_blank">ftp://upload_site:port/pat...</a><br/>当然，向http服务器上传文件也可以比如<br/>$ curl -T localfile <a href="http://cgi2.tky.3web.ne.jp/~zzh/abc.cgi" target="_blank">http://cgi2.tky.3web.ne.jp...</a><br/>注意，这时候，使用的协议是HTTP的PUT method<br/>刚才说到PUT，嘿嘿，自然让老服想起来了其他几种methos还没讲呢！ GET和POST都不能忘哦。<br/>http提交一个表单，比较常用的是POST模式和GET模式<br/>GET模式什么option都不用，只需要把变量写在url里面就可以了比如：<br/>$ curl <a href="http://www.yahoo.com/login.cgi?user=nickwolfe&password=12345" target="_blank">http://www.yahoo.com/login...</a><br/>而POST模式的option则是 -d<br/>比如，<br/>$ curl -d "user=nickwolfe&password=12345" <a href="http://www.yahoo.com/login.cgi" target="_blank">http://www.yahoo.com/login...</a><br/>就相当于向这个站点发出一次登陆申请 &nbsp; &nbsp;~<br/>到底该用GET模式还是POST模式，要看对面服务器的程序设定。<br/>一点需要注意的是，POST模式下的文件上的文件上传，比如<br/><form method="POST" enctype="multipar/form-data" action="http://cgi2.tky.3web.ne.jp/~zzh/up_file.cgi"><br/><input type=file name=upload><br/><input type=submit name=nick value="go"><br/></form><br/>这样一个HTTP表单，我们要用curl进行模拟，就该是这样的语法：<br/>$ curl -F upload=@localfile -F nick=go <a href="http://cgi2.tky.3web.ne.jp/~zzh/up_file.cgi" target="_blank">http://cgi2.tky.3web.ne.jp...</a><br/>罗罗嗦嗦讲了这么多，其实curl还有很多很多技巧和用法比如 https的时候使用本地证书，就可以这样<br/>$ curl -E localcert.pem <a href="https://remote_server" target="_blank">https://remote_server</a><br/>再比如，你还可以用curl通过dict协议去查字典 &nbsp; &nbsp;~<br/>$ curl dict://dict.org/d:computer<br/>Tags - <a href="http://5iwww.vicp.net/tag.php?tag=curl" rel="tag">curl</a>
  ]]> 
</description>
</item><item>
<link>http://5iwww.vicp.net/read.php?1067</link>
<title>比办公室老女人强很多的丫头</title> 
<author>井宿 &lt;wanjun@5iwww.com&gt;</author>
<category>图片收藏</category>
<pubDate>Mon, 25 May 2009 18:53:06 +0000</pubDate> 
<guid>http://5iwww.vicp.net/read.php?1067</guid> 
<description>
<![CDATA[ 
	<a href="http://media.blackie.channelv.com/video/user_images/397_DSCN8512.JPG" target="_blank"><img src="http://media.blackie.channelv.com/video/user_images/397_DSCN8512.JPG" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a>
  ]]> 
</description>
</item><item>
<link>http://5iwww.vicp.net/read.php?1066</link>
<title>哇哈哈 cjc 终成一对儿～</title> 
<author>井宿 &lt;wanjun@5iwww.com&gt;</author>
<category>闲言碎语</category>
<pubDate>Wed, 25 Mar 2009 15:23:38 +0000</pubDate> 
<guid>http://5iwww.vicp.net/read.php?1066</guid> 
<description>
<![CDATA[ 
	<a href="http://5iwww.vicp.net/attachment/1237994447_0.jpg" target="_blank"><img src="http://5iwww.vicp.net/attachment/1237994447_0.jpg" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><br/>o YEAH!~ &nbsp;CJC 漫画研究所里的那对儿最终的情侣 不是 井 vs asuka;不是 乱马 vs 小茜; 不是 苏小小 vs 樱桃小丸子; 也不是 BOSS vs LEE ; 而是～ 哇哈哈～ &nbsp;湖都 vs Toy! &nbsp; <br/><br/>真是惊喜啊～ &nbsp;cjc 反正弦 的朋友们， 为他们祝福吧～<br/><br/>jin: &nbsp;少见的爱情马拉松+网恋成功！<br/>Tags - <a href="http://5iwww.vicp.net/tag.php?tag=cjc" rel="tag">cjc</a> , <a href="http://5iwww.vicp.net/tag.php?tag=%E6%BC%AB%E7%94%BB%E7%A0%94%E7%A9%B6%E6%89%80" rel="tag">漫画研究所</a> , <a href="http://5iwww.vicp.net/tag.php?tag=%E5%8F%8D%E6%AD%A3%E5%BC%A6" rel="tag">反正弦</a> , <a href="http://5iwww.vicp.net/tag.php?tag=%E6%B9%96%E9%83%BD" rel="tag">湖都</a> , <a href="http://5iwww.vicp.net/tag.php?tag=toy" rel="tag">toy</a>
  ]]> 
</description>
</item><item>
<link>http://5iwww.vicp.net/read.php?1065</link>
<title>随笔</title> 
<author>井宿 &lt;wanjun@5iwww.com&gt;</author>
<category>闲言碎语</category>
<pubDate>Wed, 11 Mar 2009 15:21:40 +0000</pubDate> 
<guid>http://5iwww.vicp.net/read.php?1065</guid> 
<description>
<![CDATA[ 
	今天打羽毛球的时候，收到一条短信，是雪凌发来的，很简短，就几个字“我明天结婚了，雪凌”。<br/><br/>很好，很强大。<br/><br/>心底有一点点失落的感觉，嘿嘿。<br/><br/>只有她在分手后还能和我聊聊，见个面吃吃饭。<br/><br/>现在很想知道她老公什么样子，还有结婚的时候婚纱照是什么样子。<br/><br/>希望那是最美。
  ]]> 
</description>
</item><item>
<link>http://5iwww.vicp.net/read.php?1064</link>
<title>awk中使用shell变量疑问</title> 
<author>井宿 &lt;wanjun@5iwww.com&gt;</author>
<category>技术文档</category>
<pubDate>Mon, 16 Feb 2009 07:28:36 +0000</pubDate> 
<guid>http://5iwww.vicp.net/read.php?1064</guid> 
<description>
<![CDATA[ 
	　　#!/bin/sh<br/><br/>　　echo “ENTER:”<br/><br/>　　read key<br/><br/>　　cat tt&#124;awk ‘{if(prev==”$key”)print;prev=$1}<br/><br/>　　以上内容<br/><br/>　　如果我输：2002/01/01<br/><br/>　　没结果输出！<br/><br/>　　又错了？<br/><br/>　　你的想法不错，但awk中不能如此使用变量，可改成以下形式，便可以了。<br/><br/>　　echo “enter:”<br/><br/>　　read key<br/><br/>　　export key<br/><br/>　　cat filename&#124;awk ‘{if(prev==ENVIRON["key"])print;prev=$1}’<br/><br/>　　这样也可以：<br/><br/>　　echo “enter:”<br/><br/>　　read key<br/><br/>　　cat filename&#124;awk ‘{if(prev==”‘$key’”)print;prev=$1}’<br/><br/>　　还有很多种方法.就不一一列举了.可以查看于awk有关的帖子.<br/><br/>　　版主。在AWK中使用SHELL变量还有别的方法吗？除了你使用的：<br/><br/>　　export value<br/><br/>　　a=environ['key']<br/><br/>　　-v 选项也可以指定一个变量<br/><br/>　　这个问题原来讨论过，搜索一下吧<br/><br/>　　shell变量传给awk，我会这样用，尤其当传入的变量特长(>399byte)时！！！<br/><br/>　　export a=”hello”<br/><br/>　　awk ‘BEGIN{ “echo $a” &#124; getline x; print x; }’<br/><br/>　　var1=abcd<br/><br/>　　var2=efgh<br/><br/>　　echo “” &#124; awk -v first=$var1 -v second=$var2 ‘{print first”"second}’<br/><br/>　　[DISPLAY] abcdefgh<br/>Tags - <a href="http://5iwww.vicp.net/tag.php?tag=awk" rel="tag">awk</a> , <a href="http://5iwww.vicp.net/tag.php?tag=shell" rel="tag">shell</a> , <a href="http://5iwww.vicp.net/tag.php?tag=%E5%8F%98%E9%87%8F" rel="tag">变量</a>
  ]]> 
</description>
</item><item>
<link>http://5iwww.vicp.net/read.php?1063</link>
<title>cctv北配楼大火清晰版</title> 
<author>井宿 &lt;wanjun@5iwww.com&gt;</author>
<category>闲言碎语</category>
<pubDate>Mon,  9 Feb 2009 16:14:25 +0000</pubDate> 
<guid>http://5iwww.vicp.net/read.php?1063</guid> 
<description>
<![CDATA[ 
	<a href="http://5iwww.vicp.net/attachment/1234196013_0.jpg" target="_blank"><img src="http://5iwww.vicp.net/attachment/1234196013_0.jpg" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><a href="http://5iwww.vicp.net/attachment/1234196013_1.jpg" target="_blank"><img src="http://5iwww.vicp.net/attachment/1234196013_1.jpg" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><a href="http://5iwww.vicp.net/attachment/1234196013_2.jpg" target="_blank"><img src="http://5iwww.vicp.net/attachment/1234196013_2.jpg" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><a href="http://5iwww.vicp.net/attachment/1234196013_3.jpg" target="_blank"><img src="http://5iwww.vicp.net/attachment/1234196013_3.jpg" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><a href="http://5iwww.vicp.net/attachment/1234196013_4.jpg" target="_blank"><img src="http://5iwww.vicp.net/attachment/1234196013_4.jpg" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><a href="http://5iwww.vicp.net/attachment/1234196036_0.jpg" target="_blank"><img src="http://5iwww.vicp.net/attachment/1234196036_0.jpg" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><a href="http://5iwww.vicp.net/attachment/1234196036_1.jpg" target="_blank"><img src="http://5iwww.vicp.net/attachment/1234196036_1.jpg" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><a href="http://5iwww.vicp.net/attachment/1234196036_2.jpg" target="_blank"><img src="http://5iwww.vicp.net/attachment/1234196036_2.jpg" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><a href="http://5iwww.vicp.net/attachment/1234196036_3.jpg" target="_blank"><img src="http://5iwww.vicp.net/attachment/1234196036_3.jpg" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><a href="http://5iwww.vicp.net/attachment/1234196036_4.jpg" target="_blank"><img src="http://5iwww.vicp.net/attachment/1234196036_4.jpg" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><a href="http://5iwww.vicp.net/attachment/1234196048_0.jpg" target="_blank"><img src="http://5iwww.vicp.net/attachment/1234196048_0.jpg" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><br/>Tags - <a href="http://5iwww.vicp.net/tag.php?tag=cctv" rel="tag">cctv</a> , <a href="http://5iwww.vicp.net/tag.php?tag=%E5%A4%A7%E7%81%AB" rel="tag">大火</a> , <a href="http://5iwww.vicp.net/tag.php?tag=%E5%85%83%E5%AE%B5%E8%8A%82" rel="tag">元宵节</a>
  ]]> 
</description>
</item><item>
<link>http://5iwww.vicp.net/read.php?1062</link>
<title>我姐姐也是美女</title> 
<author>井宿 &lt;wanjun@5iwww.com&gt;</author>
<category>闲言碎语</category>
<pubDate>Mon,  9 Feb 2009 16:04:04 +0000</pubDate> 
<guid>http://5iwww.vicp.net/read.php?1062</guid> 
<description>
<![CDATA[ 
	恩，这个，女人结婚的时候最美了，尤其是这几张中的姐姐，不比以往搜集的美女图片中的逊色哦～<br/><br/><p align="center"><a href="http://5iwww.vicp.net/attachment/1234195418_0.jpg" target="_blank"><img src="http://5iwww.vicp.net/attachment/1234195418_0.jpg" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a></p><br/><br/><p align="center"><a href="http://5iwww.vicp.net/attachment/1234195418_2.jpg" target="_blank"><img src="http://5iwww.vicp.net/attachment/1234195418_2.jpg" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a></p><br/>Tags - <a href="http://5iwww.vicp.net/tag.php?tag=%E5%A7%90%E5%A7%90" rel="tag">姐姐</a> , <a href="http://5iwww.vicp.net/tag.php?tag=%E7%BE%8E%E5%A5%B3" rel="tag">美女</a>
  ]]> 
</description>
</item><item>
<link>http://5iwww.vicp.net/read.php?1061</link>
<title>登录linux后，在注销之前，想删除该用户所有操作记录</title> 
<author>井宿 &lt;wanjun@5iwww.com&gt;</author>
<category>技术文档</category>
<pubDate>Mon,  9 Feb 2009 09:54:53 +0000</pubDate> 
<guid>http://5iwww.vicp.net/read.php?1061</guid> 
<description>
<![CDATA[ 
	比如：<br/>用last、lastlog、history等命令，都能看到该用户上次的登录信息。<br/>history -c 清除history <br/>cat /dev/null >; /var/log/wtmp &nbsp; 清除last 命令的<br/>cat /dev/null >; /var/log/lastlog 清楚lastlog的 <br/><br/>Tags - <a href="http://5iwww.vicp.net/tag.php?tag=history" rel="tag">history</a> , <a href="http://5iwww.vicp.net/tag.php?tag=last" rel="tag">last</a> , <a href="http://5iwww.vicp.net/tag.php?tag=lastlog" rel="tag">lastlog</a>
  ]]> 
</description>
</item><item>
<link>http://5iwww.vicp.net/read.php?1060</link>
<title>iis不支持直接写log到网络驱动器</title> 
<author>井宿 &lt;wanjun@5iwww.com&gt;</author>
<category>心得体会</category>
<pubDate>Thu,  5 Feb 2009 02:03:44 +0000</pubDate> 
<guid>http://5iwww.vicp.net/read.php?1060</guid> 
<description>
<![CDATA[ 
	因为要对IIS日志进行处理,故在linux下开启了一个samba,并且将共享路径影射成网络驱动器,但是实际使用中发现,IIS日志无法写入网络驱动器,经过察看事件管理器的系统日志发现, IIS不支持这种写入方式,log路径只能以unc方式配置,故把网络驱动器路径改为 //host/path/iis-log, 问题就解决了.<br/>Tags - <a href="http://5iwww.vicp.net/tag.php?tag=iis" rel="tag">iis</a> , <a href="http://5iwww.vicp.net/tag.php?tag=log" rel="tag">log</a> , <a href="http://5iwww.vicp.net/tag.php?tag=samba" rel="tag">samba</a> , <a href="http://5iwww.vicp.net/tag.php?tag=%E7%BD%91%E7%BB%9C%E9%A9%B1%E5%8A%A8%E5%99%A8" rel="tag">网络驱动器</a> , <a href="http://5iwww.vicp.net/tag.php?tag=unc" rel="tag">unc</a>
  ]]> 
</description>
</item>
</channel>
</rss>