borg2-backup.sh: exclude log-files from backup.

This commit is contained in:
Christoph 2025-03-08 16:23:52 +01:00
parent 70bcd54cea
commit 079fd850e6

View File

@ -194,7 +194,7 @@ fi
# Default values
# ----------
DEFAULT_BORG_LOG_DIR="/var/log/borg/"
DEFAULT_BORG_LOG_DIR="/var/log/borg"
DEFAULT_SSH_USER="borg"
DEFAULT_SSH_PORT=22
@ -800,47 +800,59 @@ fi
echononl "Create borg backup.."
cat << EOF >> ${BORG_LOG_FILE}
borg2 \\
--remote-path borg2 \\
--repo ${BORG_URL} \\
create \\
--verbose \\
--filter AME \\
--list \\
--stats \\
--show-rc \\
--compression lz4 \\
--exclude-caches \\
--exclude 'home/*/.cache/*' \\
--exclude '/root/.cache/*' \\
--exclude '/root/.config/*' \\
--exclude '/root/.local/*' \\
--exclude 'var/tmp/*' \\
${ARCHIVE_NAME} \\
${BORG_BACKUP_DIRS} \\
borg2 \\
--remote-path borg2 \\
--repo ${BORG_URL} \\
create \\
--verbose \\
--filter AME \\
--list \\
--stats \\
--show-rc \\
--compression lz4 \\
--exclude-caches \\
--exclude 'home/*/.cache/*' \\
--exclude '/root/.cache/*' \\
--exclude '/root/.config/*' \\
--exclude '/root/.local/*' \\
--exclude '**/tmp/*' \\
--exclude '*.lock' \\
--exclude '*.log' \\
--exclude '*.log.[0-9]' \\
--exclude '*.log.[0-9]*.gz' \\
--exclude '**/sessions/*' \\
--exclude '**/*.20[2-3][0-9]-[0-1][0-9]*' \\
${ARCHIVE_NAME} \\
${BORG_BACKUP_DIRS} \\
${DB_BACKUP_DIR}
EOF
borg2 \
--remote-path borg2 \
--repo ${BORG_URL} \
create \
--verbose \
--filter AME \
--list \
--stats \
--show-rc \
--compression lz4 \
--exclude-caches \
--exclude 'home/*/.cache/*' \
--exclude '/root/.cache/*' \
--exclude '/root/.config/*' \
--exclude '/root/.local/*' \
--exclude 'var/tmp/*' \
${ARCHIVE_NAME} \
${BORG_BACKUP_DIRS} \
${DB_BACKUP_DIR} \
borg2 \
--remote-path borg2 \
--repo ${BORG_URL} \
create \
--verbose \
--filter AME \
--list \
--stats \
--show-rc \
--compression lz4 \
--exclude-caches \
--exclude 'home/*/.cache/*' \
--exclude '/root/.cache/*' \
--exclude '/root/.config/*' \
--exclude '/root/.local/*' \
--exclude '**/tmp/*' \
--exclude '*.lock' \
--exclude '*.log' \
--exclude '*.log.[0-9]' \
--exclude '*.log.[0-9]*.gz' \
--exclude '**/sessions/*' \
--exclude '**/*.20[2-3][0-9]-[0-1][0-9]*' \
${ARCHIVE_NAME} \
${BORG_BACKUP_DIRS} \
${DB_BACKUP_DIR} \
> ${log_file} 2>&1