summaryrefslogtreecommitdiffstats
path: root/Bash/mysql-database-backup.sh
diff options
context:
space:
mode:
Diffstat (limited to 'Bash/mysql-database-backup.sh')
-rw-r--r--Bash/mysql-database-backup.sh12
1 files changed, 6 insertions, 6 deletions
diff --git a/Bash/mysql-database-backup.sh b/Bash/mysql-database-backup.sh
index a2df521..ef4e2e1 100644
--- a/Bash/mysql-database-backup.sh
+++ b/Bash/mysql-database-backup.sh
@@ -1,9 +1,9 @@
#!/bin/bash
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%#
-# MySQL database backup script [Thomas Lange <thomas@nerdmind.de>] #
+# MySQL database backup script [Thomas Lange <tl@nerdmind.de>] #
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%#
# #
-# This database backup script loop through each database (except the excluded #
+# This database backup script goes through each database (except the excluded #
# databases in DATABASE_EXCLUDED) and creates a bzip2 compressed backup file. #
# #
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%#
@@ -18,7 +18,7 @@ DATABASE_EXCLUDED="(Database|mysql|information_schema|performance_schema)"
#===============================================================================
# Define backup directories and target filename
#===============================================================================
-DIRECTORY_ROOT="/mnt/backups/databases/"
+DIRECTORY_ROOT="/mnt/data/backups/databases/"
DIRECTORY_PATH="$(date +%Y-%m-%d-%Hh%Mm)/"
DIRECTORY_FILE="${DIRECTORY_ROOT}${DIRECTORY_PATH}%s.sql.bz2"
@@ -35,14 +35,14 @@ if [ ! -d "${DIRECTORY_ROOT}${DIRECTORY_PATH}" ]; then
fi
#===============================================================================
-# Fetch all databases from local MySQL server
+# Fetch all database names from local MySQL server
#===============================================================================
DATABASES=`mysql --user="${DATABASE_USERNAME}" --password="${DATABASE_PASSWORD}" --execute="SHOW DATABASES;" | grep -Ev "${DATABASE_EXCLUDED}"`
#===============================================================================
-# Loop through all databases and create compressed dump
+# Loop through all database names and create compressed database backup
#===============================================================================
for database in ${DATABASES}; do
- echo "[INFO] Creating compressed database backup for ${database}"
+ echo "[INFO] Creating compressed backup for database ${database} [...]"
mysqldump --lock-all-tables --user="${DATABASE_USERNAME}" --password="${DATABASE_PASSWORD}" "${database}" | bzip2 > $(printf "${DIRECTORY_FILE}" "${database}")
done \ No newline at end of file