Do you really need to compress the file?
wgetprovides -N, --timestamping, which obviously includes time-stamping. What does this mean, say your file is located at www.example.com/file.txt
For the first time:
$ wget -N www.example.com/file.txt
[...]
[...] file.txt saved [..size..]
Next time it will be as follows:
$ wget -N www.example.com/file.txt
Server file no newer than local file "file.txt" -- not retrieving.
, .
, .
, , , / . , ? , ? ? txt ? ?
, .
, -, sha256 xz (lzma2).
- ( Bash):
newfilesum="$(wget -q www.example.com/file.txt -O- | tee file.txt | sha256sum)"
oldfilesum="$(xzcat file.txt.xz | sha256sum)"
if [[ $newfilesum != $oldfilesum ]]; then
xz -f file.txt
else
rm file.txt
fi
;