diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2015-08-05 22:17:45 +0200 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2015-08-05 22:17:45 +0200 |
commit | 57183d283f5c623747ae0cb54e3454492cccbdf4 (patch) | |
tree | d5edbe4bab4af49a201e976a84eeec6382b0d29f /sfeed_update | |
parent | 4924d21423bbac9393c26b5e9cff6fbd61e0d103 (diff) |
sfeed_update: fix time modified on feed first run
A feeds file was created with touch when it didnt exist. This confuses
curl -z since it uses that file for If-Modified-Since. Now it just
copies the temporary file to the new file without merging if it doesn't
exist. The warning for curl for a non-existant file is already suppressed
with curl -s.
Diffstat (limited to 'sfeed_update')
-rwxr-xr-x | sfeed_update | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/sfeed_update b/sfeed_update index 30b2c67..58d25fc 100755 --- a/sfeed_update +++ b/sfeed_update @@ -80,10 +80,15 @@ feed() { # get new data and merge with old. sfeedfilenew="${sfeeddir}/${name}.new" - touch "${sfeedfile}" - merge "${sfeedfile}" "${tmpfeedfile}" > "${sfeedfilenew}" - # overwrite old file with updated file - mv "${sfeedfilenew}" "${sfeedfile}") & + # if file exists, merge + if [ -e "${sfeedfile}" ]; then + merge "${sfeedfile}" "${tmpfeedfile}" > "${sfeedfilenew}" + # overwrite old file with updated file + mv "${sfeedfilenew}" "${sfeedfile}" + else + # else just copy + mv "${tmpfeedfile}" "${sfeedfile}" + fi) & } terminated() { |