MySQL backup implementation
This commit is contained in:
parent
6fa438e81e
commit
223eff0d1b
@ -21,4 +21,9 @@ target_key='/home/xyz/.ssh/rsync' # rsync key
|
||||
docker_enabled=false # will you use docker backup
|
||||
docker_images=false # backup docker images
|
||||
docker_volumes=false #backup docker volumes
|
||||
docker_data=false #backup container information
|
||||
docker_data=false #backup container information
|
||||
db_backup=false #backup databases
|
||||
database_type=mysql #mysql or postgresql
|
||||
db_username=user #database user
|
||||
db_password=user #database password
|
||||
db_name=user #name of the database
|
12
main.sh
12
main.sh
@ -233,6 +233,18 @@ function dockerbackup {
|
||||
fi
|
||||
}
|
||||
|
||||
function backup_db {
|
||||
if [ "$db_backup" = true ]
|
||||
then
|
||||
echo "Backing up database..." >&2
|
||||
mkdir -p $tmpdir/db
|
||||
if [ "$database_type" = "mysql" ]
|
||||
then
|
||||
mysqldump -u "$db_username" -p"$db_password" "$db_name" > $tmpdir/db/db.sql
|
||||
elif [ "$database_type" = "postgresql" ]
|
||||
echo "soon"
|
||||
}
|
||||
|
||||
function runbackup {
|
||||
# init, config check
|
||||
init
|
||||
|
Loading…
Reference in New Issue
Block a user