#! /bin/sh
FIND_ARGS="/archive/movies/ /archive/anime/ /archive/music/ /archive/games/"
BASE="/var/db/feeds/archive/"
OUTPUT="/www/netvor.sk/public_html/_/feeds/archive.rss"
find $FIND_ARGS > $BASE/snapshot.new
CHANGESET=`diff -N -u $BASE/snapshot $BASE/snapshot.new | grep '^[-+]/' | sed 's/$/
/'`
mv $BASE/snapshot.new $BASE/snapshot
if [ "x" != "x$CHANGESET" ]; then
ITEM="- `date`
"
echo "$ITEM" >> $BASE/messages.xml
cat $BASE/head.xml $BASE/messages.xml $BASE/tail.xml > $OUTPUT
fi