Skip to content

Commit ca6abe4

Browse files
committed
Added support for mariadb-dump
1 parent fc67c10 commit ca6abe4

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

backup.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# URL: https://github.com/zevilz/WebServerCloudBackups
44
# Author: zEvilz
55
# License: MIT
6-
# Version: 1.10.0
6+
# Version: 1.10.1
77

88
checkFilePermissions()
99
{
@@ -34,6 +34,7 @@ CLOUD_SUBDIR_FILES=
3434
CLOUD_SUBDIR_BASES=
3535
SCRIPT_INSTANCE_KEY=$(tr -cd 'a-zA-Z0-9' < /dev/urandom | head -c 10)
3636
SCRIPT_ERRORS_TMP="/tmp/wscb.tmp.${SCRIPT_INSTANCE_KEY}"
37+
MYSQLDUMP="mysqldump"
3738

3839
. "${CUR_PATH}/backup.conf"
3940

@@ -171,6 +172,10 @@ if [[ "$SORT_BACKUPS" == "true" ]]; then
171172
CLOUD_SUBDIR_BASES="/databases"
172173
fi
173174

175+
if command -v mariadb-dump >/dev/null 2>&1; then
176+
MYSQLDUMP="mariadb-dump"
177+
fi
178+
174179
# projects loop
175180
for i in "${!projects[@]}"
176181
do
@@ -604,7 +609,7 @@ do
604609

605610
DUMP_SINGLE_TRANSACTION_FAIL=0
606611

607-
mysqldump --insert-ignore --skip-lock-tables --single-transaction=TRUE --add-drop-table --no-tablespaces -u "$MYSQL_USER" --password="$MYSQL_PASS" "$PROJECT_DB" 2>"$SCRIPT_ERRORS_TMP" | gzip > "$MYSQL_DUMP_PATH"
612+
$MYSQLDUMP --insert-ignore --skip-lock-tables --single-transaction=TRUE --add-drop-table --no-tablespaces -u "$MYSQL_USER" --password="$MYSQL_PASS" "$PROJECT_DB" 2>"$SCRIPT_ERRORS_TMP" | gzip > "$MYSQL_DUMP_PATH"
608613

609614
DUMP_ERRORS=$(cat "$SCRIPT_ERRORS_TMP" 2>/dev/null | grep -v 'Using a password' 2>&1)
610615
DUMP_ERRORS=$(echo "$DUMP_ERRORS" | grep -v 'Forcing protocol to' 2>&1)
@@ -639,7 +644,7 @@ do
639644
if [ "$DUMP_SINGLE_TRANSACTION_FAIL" -eq 1 ]; then
640645
echo -n "Creating database dump (disabled --single-transaction)..."
641646

642-
mysqldump --insert-ignore --skip-lock-tables --add-drop-table --no-tablespaces -u "$MYSQL_USER" --password="$MYSQL_PASS" "$PROJECT_DB" 2>"$SCRIPT_ERRORS_TMP" | gzip > "$MYSQL_DUMP_PATH"
647+
$MYSQLDUMP --insert-ignore --skip-lock-tables --add-drop-table --no-tablespaces -u "$MYSQL_USER" --password="$MYSQL_PASS" "$PROJECT_DB" 2>"$SCRIPT_ERRORS_TMP" | gzip > "$MYSQL_DUMP_PATH"
643648

644649
DUMP_ERRORS=$(cat "$SCRIPT_ERRORS_TMP" 2>/dev/null | grep -v 'Using a password' 2>&1)
645650
DUMP_ERRORS=$(echo "$DUMP_ERRORS" | grep -v 'Forcing protocol to' 2>&1)

0 commit comments

Comments
 (0)