sfeed

Simple RSS and Atom feed parser
git clone https://git.sinitax.com/codemadness/sfeed
Log | Files | Refs | README | LICENSE | Upstream | sfeed.txt

commit 57183d283f5c623747ae0cb54e3454492cccbdf4
parent 4924d21423bbac9393c26b5e9cff6fbd61e0d103
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Wed,  5 Aug 2015 22:17:45 +0200

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:
Msfeed_update | 13+++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)

diff --git 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() {