tag:blogger.com,1999:blog-3803541356848955053.post1151026256018965380..comments2016-05-06T18:44:33.019-07:00Comments on YJL: Downloading only when modified using cURL in BashYu-Jie Linhttps://plus.google.com/115422682039760465813[email protected]Blogger8125tag:blogger.com,1999:blog-3803541356848955053.post-87350649270149088602016-04-13T01:07:01.815-07:002016-04-13T01:07:01.815-07:00hi all. I have got some issue with curl -z comman...hi all. <br />I have got some issue with curl -z command. Does anyone know which format of date should I use: I got this error:<br /><br />Warning: Illegal date format for -z, --timecond (and not a file name).<br />Warning: Disabling time condition. See curl_getdate(3) for valid date syntax.<br /><br /><br /><br />My script:<br /><br />#!/bin/bash/<br />today=$(date +%Y%m%d%H%M)<br />curl -u admin:admin -z &quot;$today&quot; --data &quot;delay=3&amp;force=false&amp;target=/bkps/inc-$today.zip&quot; \<br />http://localhost:4502/libs/granite/backup/content/admin/backups/<br />Seweryn Siewerthttp://www.blogger.com/profile/05220063714340415477[email protected]tag:blogger.com,1999:blog-3803541356848955053.post-57083682137537794012013-09-14T04:50:38.899-07:002013-09-14T04:50:38.899-07:00Did you get status code 200? If you read my post...Did you get status code 200?<br /><br /><br />If you read my post you would see the first time it will get 200, then 304, as it is supposed to be by HTTP specification.<br /><br /><br /><br />Read carefully my post, see what the process really is. Don&#39;t just run commands when you are still not sure the whole thing.<br /><br /><br /><br />You really need to give more complete information, post complete commands and outputs to pastebin or something, if you do actually want my help, or I will just wild guess what&#39;s going on.livibetterhttp://yjl.im/[email protected]tag:blogger.com,1999:blog-3803541356848955053.post-8213615814767305652013-09-14T03:59:31.206-07:002013-09-14T03:59:31.206-07:00I tried it, but it doesn&#39;t seem to respond the...I tried it, but it doesn&#39;t seem to respond the 304. Else it works it seems. As for compress, it works very well, on my system it sends deflate, gzip which is very good.<br /><br />curl http://www.example.com -z index.html -o index.html --verbose --compress<br /><br />I will dig into it later, because I will need to do some inspection of my server logs. I still have a thinking it shouldn&#39;t be nesssary to store a time stamp also, if you already have stored the file itself. But maybe I haven&#39;t understood everything of this.<br /><br />But thanks for your answers so far, they have been very helpfull to me.Rune Jensen[email protected]tag:blogger.com,1999:blog-3803541356848955053.post-84811459328875971852013-09-14T03:32:35.906-07:002013-09-14T03:32:35.906-07:00I see that. Now. I will try that, thanks.I see that. Now. I will try that, thanks.Rune Jensen[email protected]tag:blogger.com,1999:blog-3803541356848955053.post-37599087903233721902013-09-14T02:00:15.158-07:002013-09-14T02:00:15.158-07:00The first line of The Flow section is actually tal...The first line of <i>The Flow</i> section is actually talking about this -z.<br /><br /><br />There will be warnings when first used, it may be the errors you are talking about. You need to post the messages so I can understand what you were seeing. Anyway, if you use the command and options I used in the post, the -z does work.livibetterhttp://yjl.im/[email protected]tag:blogger.com,1999:blog-3803541356848955053.post-56896551652385159302013-09-14T01:46:27.754-07:002013-09-14T01:46:27.754-07:00You&#39;re right, I cannot seem to find iv now eit...You&#39;re right, I cannot seem to find iv now either. However, there is another flag, which should work, the -z time cond<br /><br /><br /><br /><br />&quot;<br />TIME CONDITIONS<br /> <br /> HTTP allows a client to specify a time condition for the document it<br /> requests. It is If-Modified-Since or If-Unmodified-Since. Curl allows you to<br /> specify them with the -z/--time-cond flag.<br /> <br /> For example, you can easily make a download that only gets performed if the<br /> remote file is newer than a local copy. It would be made like:<br /> <br /> curl -z local.html http://remote.server.com/remote.html<br />&quot;<br /><br /><br />...It just doesn&#39;t work. I get errors when I try it.Rune Jensen[email protected]tag:blogger.com,1999:blog-3803541356848955053.post-63939140107369247042013-09-12T23:34:27.816-07:002013-09-12T23:34:27.816-07:00First of all, I am not sure whose -r you are talki...First of all, I am not sure whose -r you are talking about, I checked ls, stat, curl, even wget. There didn&#39;t seem to be the one you are talking. But this sounds like a good idea, anyway. There is a -R as in --remote-time. However, from the description, it didn&#39;t seem to enable downloading only when the file gets updated:<br /><br />When used, this will make curl attempt to figure out the timestamp of the remote file, and if that is available make the local file get that same timestamp.<br /><br /><br /><br />So, it really doesn&#39;t help.<br /><br /><br />Besides, if choosing not to keep the file, even curl has an option to check timestamp and download only if updated. Since you don&#39;t have file, you need to keep the timestamp elsewhere.livibetterhttp://yjl.im/[email protected]tag:blogger.com,1999:blog-3803541356848955053.post-33278188065064190662013-09-12T21:49:17.763-07:002013-09-12T21:49:17.763-07:00Why not just use the last modified of the file its...Why not just use the last modified of the file itself? It has a flag AFAIKS, it&#39;s called -r<br /><br />then you do not need to store a timestamp. It&#39;s already in the file itself.Rune Jensen[email protected]