Added mysql backup script

This commit is contained in:
mandlm 2020-02-03 21:06:20 +01:00
parent 033202a6a4
commit a263b53dc3
3 changed files with 17 additions and 1 deletions

View File

@ -1,6 +1,6 @@
from debian from debian
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y wget lftp RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y wget lftp mariadb-client
RUN TF=`mktemp` &&\ RUN TF=`mktemp` &&\
wget "https://hndl.urbackup.org/Client/latest/update/UrBackupUpdateLinux.sh" -O $TF &&\ wget "https://hndl.urbackup.org/Client/latest/update/UrBackupUpdateLinux.sh" -O $TF &&\

13
scripts/mysql_backup.sh Normal file
View File

@ -0,0 +1,13 @@
#!/usr/bin/env bash
BACKUP_DIR="/backup/database"
echo
echo "Starting to backup database"
date
mkdir --parents $BACKUP_DIR
mysqldump --single-transaction --host=$MYSQL_BACKUP_HOST --user=$MYSQL_BACKUP_USER --password=$MYSQL_BACKUP_PASSWORD $MYSQL_BACKUP_DATABASE > $BACKUP_DIR/$MYSQL_BACKUP_DATABASE.sqldump
echo
echo "Database backup finished"
date

View File

@ -4,3 +4,6 @@ if [[ -z "$DO_FTP_BACKUP" ]]; then
sh ftp_backup.sh sh ftp_backup.sh
fi fi
if [[ -z "$DO_MYSQL_BACUP" ]]; then
sh mysql_backup.sh
fi