ARCHIVE_LABEL="backup-data-amd64-`date '+%Y-%m-%d'`"
# Exclude files list
-EXC_LIST="/tmp/exclude-sockets"
+EXC_LIST="/tmp/hv-backup-exclude-list"
print_usage()
{
echo "ARCHIVE_LABEL=$ARCHIVE_LABEL"
-# Finding sockets
-find ${DIRECTORIES} -type s > ${EXC_LIST} || exit 1
+cat > ${EXC_LIST} << "EOF"
+/media/*
+/proc/*
+/dev/*
+/sys/*
+/tmp/*
+*.sock
+*.lock
+*/.gvfs*
+EOF
+
+# Finding sockets, and listing them in the exclude file.
+# Errors and warnings must be discarded because of .gvfs directory for example.
+# Even when using -prune option, find exits with a non-zero status when resding
+# .gvfs
+find ${BKP_FILES_LIST} -type s >> ${EXC_LIST} 2> /dev/null
# Archiving
tar jcf ${ARCHIVE_NAME} ${BKP_FILES_LIST} \
- --ignore-failed-read \
--label="${ARCHIVE_LABEL}" \
- --exclude="*.sock" --exclude="*.lock" --exclude-from=${EXC_LIST} \
- --absolute-names --totals
+ --ignore-failed-read \
+ --exclude-backups \
+ --exclude-caches \
+ --exclude-from=${EXC_LIST} \
+ --absolute-names \
+ --totals
rm ${EXC_LIST}