We are happy to announce that Vesta is back under active development as of 25 February 2024. We are working on v1 candidate and expect to engage more with the community over the coming months. We are committed to open source, and we encourage contributors to help us build the future of Vesta.
Script to backup the db for each site
-
- Posts: 10
- Joined: Thu Aug 23, 2018 8:58 pm
- Os: CentOS 6x
- Web: nginx + php-fpm
Script to backup the db for each site
Hello, I'm taking another backup strategy for my VPS and now I'm trying to backup up only the db for each site and put in the folder of each one.
How can I accomplish that in the most automated way?
Thanks.
How can I accomplish that in the most automated way?
Thanks.
Re: Script to backup the db for each site
Hmm, you can use mysqldump and gzip, but why not use the integrated way for backup? Ypu can alsp check the v-backup-user file tp understand, how vesta is doing that job.
-
- Posts: 10
- Joined: Thu Aug 23, 2018 8:58 pm
- Os: CentOS 6x
- Web: nginx + php-fpm
Re: Script to backup the db for each site
I'm using restic to make incremental backups, is faster and use less bandwidth.
Will take a look in the script and try to find something.
Thanks
Will take a look in the script and try to find something.
Thanks
-
- Posts: 10
- Joined: Thu Aug 23, 2018 8:58 pm
- Os: CentOS 6x
- Web: nginx + php-fpm
Re: Script to backup the db for each site
I think that's ie beyond my understanding I'm don't enough knowledge of shell script to understand modify this script to do what I want.
Re: Script to backup the db for each site
So I would think it is the savest way for you to use the internal backup engine - so you can be sure that the backup is working properly.
-
- Posts: 10
- Joined: Thu Aug 23, 2018 8:58 pm
- Os: CentOS 6x
- Web: nginx + php-fpm
Re: Script to backup the db for each site
I'm using the internal backup too, but each backup has 2GB, using restic I can make a new snapshot using just the changed files, is more efficient.
Last edited by augustocarmo on Mon Sep 10, 2018 3:46 pm, edited 1 time in total.
Re: Script to backup the db for each site
You can make easy script to backup all dabase per user not is to hard
You can take part of code from here: https://github.com/Skamasle/Incremental ... -backup.sh
You just need modify two functions:
This get user
This make a backup
The code is there just modify to aply it for your scripts
You can take part of code from here: https://github.com/Skamasle/Incremental ... -backup.sh
You just need modify two functions:
This get user
Code: Select all
sk_check_user () {
sk_user=$1
if v-list-users plain | awk '{ print $1 }' |grep -wc $sk_user ;then
sk_back $sk_user
fi
}
This make a backup
Code: Select all
function backup_mysql () {
sk_user=$1
cd /tmp/sk_backup/
mkdir DataBases
# This restore all and then transfer not good for big databases
for db in $(v-list-databases $sk_user plain | awk '{ print $1 }')
do
mysqldump $db > DataBases/$db.sql
gzip DataBases/$db.sql
done
sk_sync DataBases
rm -f DataBases/*.sql.gz
##
## Less space used, restore and transfer DBs one by one
# Need code this with modification of sk_sync() - isnt urgent
}