borg-backup.sh: clean upo from whitespaces; remove development code.

This commit is contained in:
Christoph 2024-07-02 23:03:21 +02:00
parent db2423ac43
commit 4aec86ab41

View File

@ -22,6 +22,7 @@ currentDateReadable=$(date --date @"$startTime" +"%d.%m.%Y - %H:%M:%S")
clean_up() {
# Perform program exit housekeeping
rm -f ${DB_BACKUP_DIR}/*-${backup_date}.sql
rm -rf "$LOCK_DIR"
blank_line
exit $1
@ -300,8 +301,8 @@ fi
# By default: Borg won't follow symlinks
#
BORG_BACKUP_DIRS=""
for _dir in $BACKUP_DIRECTORIES ; do
if [[ -h "${_dir}" ]] ; then
for _dir in $BACKUP_DIRECTORIES ; do
if [[ -h "${_dir}" ]] ; then
BORG_BACKUP_DIRS="$BORG_BACKUP_DIRS $(realpath "${_dir}")"
fi
BORG_BACKUP_DIRS="$BORG_BACKUP_DIRS ${_dir}"
@ -324,7 +325,7 @@ export BORG_REPO
# For 'Warning: The repository at location … was previously located at ..'
#
# This has to be set when the repository has been created by user and
# This has to be set when the repository has been created by user and
# the script is called by cron
#
export BORG_RELOCATED_REPO_ACCESS_IS_OK=yes
@ -439,14 +440,14 @@ EOF
echononl "Dump Database '${_db}'.."
cat <<EOF >> ${BORG_LOG_FILE}
mysqldump $MYSQL_CREDENTIALS \\
mysqldump $MYSQL_CREDENTIALS \\
--single-transaction --routines \\
-h localhost \\
-e ${_db} > ${DB_BACKUP_DIR}/${_db}-${backup_date}.sql
EOF
mysqldump $MYSQL_CREDENTIALS \
mysqldump $MYSQL_CREDENTIALS \
--single-transaction --routines \
-h localhost \
-e ${_db} > ${DB_BACKUP_DIR}/${_db}-${backup_date}.sql 2> ${log_file}
@ -519,7 +520,6 @@ EOF
done
fi
clean_up 0
echononl "Create borg backup.."