Compare commits
3 Commits
db2423ac43
...
f366e7d97b
Author | SHA1 | Date | |
---|---|---|---|
f366e7d97b | |||
9553c95ce9 | |||
4aec86ab41 |
@ -10,6 +10,10 @@ BORG_HOST="o26.oopen.de"
|
|||||||
BORG_REPO="/backup/mail-fm"
|
BORG_REPO="/backup/mail-fm"
|
||||||
BORG_PASSPHRASE='joG.Ir2x--VsX6/mxb.kEcmq'
|
BORG_PASSPHRASE='joG.Ir2x--VsX6/mxb.kEcmq'
|
||||||
|
|
||||||
|
BORG_HOST="o26.oopen.de"
|
||||||
|
BORG_REPO="/backup/web-05"
|
||||||
|
BORG_PASSPHRASE='FZyFW-bxXV-rHiQ7n/dAxI.L'
|
||||||
|
|
||||||
|
|
||||||
SSH_USER="borg"
|
SSH_USER="borg"
|
||||||
SSH_PORT=22
|
SSH_PORT=22
|
||||||
@ -55,6 +59,7 @@ export BORG_PASSPHRASE
|
|||||||
#
|
#
|
||||||
# chattr +i /data/backup/<client-identifier>
|
# chattr +i /data/backup/<client-identifier>
|
||||||
#
|
#
|
||||||
|
chattr +i "$(dirname "${BORG_REPO}")"
|
||||||
mkdir -p "${BORG_REPO}"
|
mkdir -p "${BORG_REPO}"
|
||||||
chown ${SSH_USER}:${SSH_USER} "${BORG_REPO}"
|
chown ${SSH_USER}:${SSH_USER} "${BORG_REPO}"
|
||||||
chattr +i "$(dirname "${BORG_REPO}")"
|
chattr +i "$(dirname "${BORG_REPO}")"
|
||||||
|
@ -22,6 +22,7 @@ currentDateReadable=$(date --date @"$startTime" +"%d.%m.%Y - %H:%M:%S")
|
|||||||
clean_up() {
|
clean_up() {
|
||||||
|
|
||||||
# Perform program exit housekeeping
|
# Perform program exit housekeeping
|
||||||
|
rm -f ${DB_BACKUP_DIR}/*-${backup_date}.sql
|
||||||
rm -rf "$LOCK_DIR"
|
rm -rf "$LOCK_DIR"
|
||||||
blank_line
|
blank_line
|
||||||
exit $1
|
exit $1
|
||||||
@ -300,8 +301,8 @@ fi
|
|||||||
# By default: Borg won't follow symlinks
|
# By default: Borg won't follow symlinks
|
||||||
#
|
#
|
||||||
BORG_BACKUP_DIRS=""
|
BORG_BACKUP_DIRS=""
|
||||||
for _dir in $BACKUP_DIRECTORIES ; do
|
for _dir in $BACKUP_DIRECTORIES ; do
|
||||||
if [[ -h "${_dir}" ]] ; then
|
if [[ -h "${_dir}" ]] ; then
|
||||||
BORG_BACKUP_DIRS="$BORG_BACKUP_DIRS $(realpath "${_dir}")"
|
BORG_BACKUP_DIRS="$BORG_BACKUP_DIRS $(realpath "${_dir}")"
|
||||||
fi
|
fi
|
||||||
BORG_BACKUP_DIRS="$BORG_BACKUP_DIRS ${_dir}"
|
BORG_BACKUP_DIRS="$BORG_BACKUP_DIRS ${_dir}"
|
||||||
@ -324,7 +325,7 @@ export BORG_REPO
|
|||||||
# For 'Warning: The repository at location … was previously located at ..'
|
# 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
|
# the script is called by cron
|
||||||
#
|
#
|
||||||
export BORG_RELOCATED_REPO_ACCESS_IS_OK=yes
|
export BORG_RELOCATED_REPO_ACCESS_IS_OK=yes
|
||||||
@ -439,14 +440,14 @@ EOF
|
|||||||
echononl "Dump Database '${_db}'.."
|
echononl "Dump Database '${_db}'.."
|
||||||
|
|
||||||
cat <<EOF >> ${BORG_LOG_FILE}
|
cat <<EOF >> ${BORG_LOG_FILE}
|
||||||
mysqldump $MYSQL_CREDENTIALS \\
|
mysqldump $MYSQL_CREDENTIALS \\
|
||||||
--single-transaction --routines \\
|
--single-transaction --routines \\
|
||||||
-h localhost \\
|
-h localhost \\
|
||||||
-e ${_db} > ${DB_BACKUP_DIR}/${_db}-${backup_date}.sql
|
-e ${_db} > ${DB_BACKUP_DIR}/${_db}-${backup_date}.sql
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
mysqldump $MYSQL_CREDENTIALS \
|
mysqldump $MYSQL_CREDENTIALS \
|
||||||
--single-transaction --routines \
|
--single-transaction --routines \
|
||||||
-h localhost \
|
-h localhost \
|
||||||
-e ${_db} > ${DB_BACKUP_DIR}/${_db}-${backup_date}.sql 2> ${log_file}
|
-e ${_db} > ${DB_BACKUP_DIR}/${_db}-${backup_date}.sql 2> ${log_file}
|
||||||
@ -519,7 +520,6 @@ EOF
|
|||||||
done
|
done
|
||||||
|
|
||||||
fi
|
fi
|
||||||
clean_up 0
|
|
||||||
|
|
||||||
|
|
||||||
echononl "Create borg backup.."
|
echononl "Create borg backup.."
|
||||||
|
@ -3,7 +3,12 @@
|
|||||||
script_name="$(basename $(realpath $0))"
|
script_name="$(basename $(realpath $0))"
|
||||||
working_dir="$(dirname $(realpath $0))"
|
working_dir="$(dirname $(realpath $0))"
|
||||||
|
|
||||||
conf_file="${working_dir}/conf/borg-backup-nc.conf"
|
|
||||||
|
if [[ -f "${working_dir}/conf/borg-backup-nc.conf" ]] ; then
|
||||||
|
conf_file="${working_dir}/conf/borg-backup-nc.conf"
|
||||||
|
else
|
||||||
|
conf_file="${working_dir}/conf/borg-backup.conf"
|
||||||
|
fi
|
||||||
|
|
||||||
LOCK_DIR="/tmp/${script_name%%.*}.LOCK"
|
LOCK_DIR="/tmp/${script_name%%.*}.LOCK"
|
||||||
log_file="${LOCK_DIR}/${script_name%%.*}.log"
|
log_file="${LOCK_DIR}/${script_name%%.*}.log"
|
||||||
|
@ -3,7 +3,11 @@
|
|||||||
script_name="$(basename $(realpath $0))"
|
script_name="$(basename $(realpath $0))"
|
||||||
working_dir="$(dirname $(realpath $0))"
|
working_dir="$(dirname $(realpath $0))"
|
||||||
|
|
||||||
conf_file="${working_dir}/conf/borg-backup-nc.conf"
|
if [[ -f "${working_dir}/conf/borg-backup-nc.conf" ]] ; then
|
||||||
|
conf_file="${working_dir}/conf/borg-backup-nc.conf"
|
||||||
|
else
|
||||||
|
conf_file="${working_dir}/conf/borg-backup.conf"
|
||||||
|
fi
|
||||||
|
|
||||||
LOCK_DIR="/tmp/${script_name%%.*}.LOCK"
|
LOCK_DIR="/tmp/${script_name%%.*}.LOCK"
|
||||||
log_file="${LOCK_DIR}/${script_name%%.*}.log"
|
log_file="${LOCK_DIR}/${script_name%%.*}.log"
|
||||||
|
@ -3,7 +3,12 @@
|
|||||||
script_name="$(basename $(realpath $0))"
|
script_name="$(basename $(realpath $0))"
|
||||||
working_dir="$(dirname $(realpath $0))"
|
working_dir="$(dirname $(realpath $0))"
|
||||||
|
|
||||||
conf_file="${working_dir}/conf/borg-backup-nc.conf"
|
|
||||||
|
if [[ -f "${working_dir}/conf/borg-backup-nc.conf" ]] ; then
|
||||||
|
conf_file="${working_dir}/conf/borg-backup-nc.conf"
|
||||||
|
else
|
||||||
|
conf_file="${working_dir}/conf/borg-backup.conf"
|
||||||
|
fi
|
||||||
|
|
||||||
LOCK_DIR="/tmp/${script_name%%.*}.LOCK"
|
LOCK_DIR="/tmp/${script_name%%.*}.LOCK"
|
||||||
log_file="${LOCK_DIR}/${script_name%%.*}.log"
|
log_file="${LOCK_DIR}/${script_name%%.*}.log"
|
||||||
|
@ -3,7 +3,12 @@
|
|||||||
script_name="$(basename $(realpath $0))"
|
script_name="$(basename $(realpath $0))"
|
||||||
working_dir="$(dirname $(realpath $0))"
|
working_dir="$(dirname $(realpath $0))"
|
||||||
|
|
||||||
conf_file="${working_dir}/conf/borg-backup-nc.conf"
|
|
||||||
|
if [[ -f "${working_dir}/conf/borg-backup-nc.conf" ]] ; then
|
||||||
|
conf_file="${working_dir}/conf/borg-backup-nc.conf"
|
||||||
|
else
|
||||||
|
conf_file="${working_dir}/conf/borg-backup.conf"
|
||||||
|
fi
|
||||||
|
|
||||||
LOCK_DIR="/tmp/${script_name%%.*}.LOCK"
|
LOCK_DIR="/tmp/${script_name%%.*}.LOCK"
|
||||||
log_file="${LOCK_DIR}/${script_name%%.*}.log"
|
log_file="${LOCK_DIR}/${script_name%%.*}.log"
|
||||||
|
Loading…
Reference in New Issue
Block a user