From 57183d283f5c623747ae0cb54e3454492cccbdf4 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Wed, 5 Aug 2015 22:17:45 +0200 Subject: 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. --- sfeed_update | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'sfeed_update') 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() { -- cgit v1.2.3