diff options
-rwxr-xr-x | sfeed_update | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/sfeed_update b/sfeed_update index eafbcfe..8185345 100755 --- a/sfeed_update +++ b/sfeed_update @@ -78,14 +78,17 @@ feed() { # get new data and merge with old. sfeedfilenew="${sfeedpath}/${name}.new" - # 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}" + # new feed data is non-empty. + if [ -s "${tmpfeedfile}" ]; then + # 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 fi) & } |