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.
customize backup script
-
- Support team
- Posts: 1096
- Joined: Sat Sep 06, 2014 9:58 pm
- Contact:
- Os: Debian 8x
- Web: apache + nginx
customize backup script
Hi,
Can anyone help me customize or create a new Backup script that only:
1. Backs up domain/public_html/ from $user/web directory recursively
2. The Databases
and create a tarball of it
Don't need any user directories or vesta Specific Configuration backup.
Can anyone help me customize or create a new Backup script that only:
1. Backs up domain/public_html/ from $user/web directory recursively
2. The Databases
and create a tarball of it
Don't need any user directories or vesta Specific Configuration backup.
Re: customize backup script
So much wasted space?mehargags wrote: Don't need any user directories or vesta Specific Configuration backup.
Remember, about restore too... if custome backup, then you need custom restore ;-(
-
- Support team
- Posts: 1096
- Joined: Sat Sep 06, 2014 9:58 pm
- Contact:
- Os: Debian 8x
- Web: apache + nginx
Re: customize backup script
Yes no problems... I can always restore manually from the tarballs... vestaCP doesn't restore backups well for me either way.skurudo wrote:So much wasted space?mehargags wrote: Don't need any user directories or vesta Specific Configuration backup.
Remember, about restore too... if custome backup, then you need custom restore ;-(
All I just need is site files + DB only
Re: customize backup script
Any progress on this case? I need to customize backup too.
Current backup script does not follow symbolic links, so my backups are not complete. Here is my file structure:
/home/admin/web/site1 - has only several files and a symbolic link
/home/admin/web/site1/public_html --> /home/admin/web/template1
/home/admin/web/site2 - has only several files and a symbolic link
/home/admin/web/site2/public_html --> /home/admin/web/template1
/home/admin/web/site3 - has only several files and a symbolic link
/home/admin/web/site3/public_html --> /home/admin/web/template1
/home/admin/web/site4 - has only several files and a symbolic link
/home/admin/web/site4/public_html --> /home/admin/web/template2
/home/admin/web/site4 - has only several files and a symbolic link
/home/admin/web/site4/public_html --> /home/admin/web/template2
/home/admin/web/template1 - has a lot of files
/home/admin/web/template2 - has a lot of files
Current backup script only backs up /home/admin/web/site* directories and does not backup /home/admin/web/template* directories. How can I make it backup /home/admin/web/template* directories too?
Thanks
Current backup script does not follow symbolic links, so my backups are not complete. Here is my file structure:
/home/admin/web/site1 - has only several files and a symbolic link
/home/admin/web/site1/public_html --> /home/admin/web/template1
/home/admin/web/site2 - has only several files and a symbolic link
/home/admin/web/site2/public_html --> /home/admin/web/template1
/home/admin/web/site3 - has only several files and a symbolic link
/home/admin/web/site3/public_html --> /home/admin/web/template1
/home/admin/web/site4 - has only several files and a symbolic link
/home/admin/web/site4/public_html --> /home/admin/web/template2
/home/admin/web/site4 - has only several files and a symbolic link
/home/admin/web/site4/public_html --> /home/admin/web/template2
/home/admin/web/template1 - has a lot of files
/home/admin/web/template2 - has a lot of files
Current backup script only backs up /home/admin/web/site* directories and does not backup /home/admin/web/template* directories. How can I make it backup /home/admin/web/template* directories too?
Thanks
-
- Support team
- Posts: 1096
- Joined: Sat Sep 06, 2014 9:58 pm
- Contact:
- Os: Debian 8x
- Web: apache + nginx
Re: customize backup script
I'm getting it made myself with the help of another forum member dpeca, lets see if it goes well!
Re: customize backup script
I found a workaround. I moved template files to /home/admin/template from /home/admin/web/template. Now template files backed up.
Re: customize backup script
* UPDATED to v0.2 *
This will backup files from ALL websites in VestaCP (each of them as separated archive), and put tar file in /backup/manual/ folder as domain.com-YYYY-MM-DD.tar(.gz)
This will backup files from ALL websites in VestaCP (each of them as separated archive), and put tar file in /backup/manual/ folder as domain.com-YYYY-MM-DD.tar(.gz)
Code: Select all
#!/bin/bash
# Options:
backup_folder=/backup/manual
compress=0
exclude="--exclude='*/tmp/*' --exclude='*/temp/*' --exclude='*/log/*' --exclude='*/logs/*' --exclude='*/session/*' --exclude='*/sessions/*' --exclude='*/cache/*' --exclude='*/caches/*'"
use_absolute_full_path=1
backup_public_html=1
backup_public_shtml=0
################################################################################################################
# begin of script
#
# *** Script for backuping all VestaCP sites (only files) ***
#
# Created by dpeca (Predrag Damnjanovic - https://forum.vestacp.com/memberlist.php?mode=viewprofile&u=8116 )
# version: 0.2
#
if [ ! -d "$backup_folder" ]; then
eval "mkdir $backup_folder"
fi
taroptions="cfP"
extension=tar
date=$(date +"%Y-%m-%d")
if [[ $compress -eq 1 ]]; then
taroptions="czfP"
extension=tar.gz
fi
function make_tar {
folder=$1
site=$2
shtml=$3
if [[ $shtml -eq 1 ]]; then
site="$site.shtml"
fi
if [[ $use_absolute_full_path -eq 1 ]]; then
command="tar $taroptions $backup_folder/$site-$date.$extension -C / $folder $exclude"
else
cd $folder
command="tar $taroptions $backup_folder/$site-$date.$extension . $exclude"
fi
# echo $command
eval $command
}
for name in /home/*
do
if [ -d "$name" ]; then
#echo $name/web
if [ -d "$name/web" ]; then
for name2 in $name/web
do
if [ -d "$name2" ]; then
#echo $name2
for name3 in $name2/*
do
if [[ $backup_public_html -eq 1 ]]; then
folder=$name3/public_html
site=$(basename $name3)
if [ -d "$folder" ]; then
make_tar $folder $site 0
fi
fi
if [[ $backup_public_shtml -eq 1 ]]; then
folder=$name3/public_shtml
site=$(basename $name3)
if [ -d "$folder" ]; then
make_tar $folder $site 1
fi
fi
done
fi
done
fi
fi
done
Last edited by dpeca on Thu Aug 25, 2016 12:44 am, edited 4 times in total.
-
- Support team
- Posts: 1096
- Joined: Sat Sep 06, 2014 9:58 pm
- Contact:
- Os: Debian 8x
- Web: apache + nginx
Re: customize backup script
Works like a charm!!
thanks a ton dpeca
thanks a ton dpeca
Re: customize backup script
Added as Idea -> https://bugs.vestacp.com/issues/364
I like this too ^_^
I like this too ^_^
-
- Support team
- Posts: 1096
- Joined: Sat Sep 06, 2014 9:58 pm
- Contact:
- Os: Debian 8x
- Web: apache + nginx
Re: customize backup script
Thanks Skurudo for liking this and putting it as feature request... Sometimes all you need is a lean-mean Website dump only to quickly migrate to a new server or give the client his/her data. Will save alot of time!skurudo wrote:Added as Idea -> https://bugs.vestacp.com/issues/364
I like this too ^_^