- if [ ! -z "$BACKLOGDB" ] && [ ! -f "$BACKLOGDB" ]; then
- BACKLOG_BASE=$(basename "$BACKLOGDB")
- cp "$BACKUP_DIR/$BACKLOG_BASE" "$BACKLOGDB"
+ if [ ! -z "$BACKLOGDB" ]; then
+
+ sqlite3 $BACKLOGDB "select * from queue limit 1" > /dev/null
+
+ if [ "$?" != "0" ]; then
+ BACKLOG_BASE=$(basename "$BACKLOGDB")
+ cp "$BACKUP_DIR/$BACKLOG_BASE" "$BACKLOGDB"
+ fi
+