Skip to content

Commit

Permalink
Update mysql-xtrabackup.sh
Browse files Browse the repository at this point in the history
Added external config
  • Loading branch information
true-patrick committed Jan 19, 2018
1 parent 8d4b832 commit 02a806f
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion mysql/mysql-xtrabackup.sh
Expand Up @@ -3,12 +3,13 @@
# True MySQL backup script for Xtrabackup implementations
#
# Author : Rene Bakkum
# Version : 1.00
# Version : 1.01
# Copyright: True B.V.
# In case you would like to make changes, let me know!
#
# Changelog:
# 1.00 Initial release
# 1.01 Added external config

PID="/backup/xtraback-running.lock"
MAILTO="root"
Expand All @@ -19,6 +20,21 @@ SUBJECT="[MySQL] Backup is still running"
KEEP_UNCOMPRESSED="180"
KEEP_COMPRESSED="2880"

CFG="${0/.sh/.cfg}"

if [ ! -e "$CFG" ]; then
cat << EOF > "$CFG"
MAILTO="$MAILTO"
BACKUPPATH="$BACKUPPATH"
SUBJECT="$SUBJECT"
# Retention periods (in minutes)
KEEP_UNCOMPRESSED="$KEEP_UNCOMPRESSED"
KEEP_COMPRESSED="$KEEP_COMPRESSED"
EOF
else
source "$CFG"
fi

if [ ! -e "$PID" ]; then
echo "Backup is still running, starting date: $(date)" > "$PID"
####
Expand Down

0 comments on commit 02a806f

Please sign in to comment.