summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsfeed_update13
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() {