How to perform an action when changing a remote file (Http)?

I want to create a script that checks the URL and performs an action (download + unzip) when changing the "Last-Modified" header of the deleted file. I was thinking about getting a header with curl, but then I have to store it somewhere for each file and do a date comparison.

Does anyone have any other idea using (mostly) standard unix tools?

thank

+3
source share
2 answers

A possible solution will periodically run this algorithm in the client window.

  • HTTP-, If-Modified-Since, . , ;
  • , If-Modified-Since " " "" 304 Not Modified HTTP.
  • 200 OK HTTP, HTTP .
  • 304 Not Modified, , .
  • Last-Modified, . datetime.

(, ) . , . , HTTP-, , .

, curl :

HTTP . If-Modified-Since -Unmodified-. Curl -z/- time-cond .

, , , , . :

curl -z local.html http://remote.server.com/remote.html

, , . , string '-', :

curl -z -local.html http://remote.server.com/remote.html

" " . , , :

curl -z http://remote.server.com/remote.html

Curl . '-', '-'.

, :

+8

Java ? , Apache HTTPcore, "If-Modified-Since" HTTP-, , , 304, , , .

+1

Source: https://habr.com/ru/post/1747522/


All Articles