T
T
Tony Green2016-06-21 12:55:25
MySQL
Tony Green, 2016-06-21 12:55:25

Ubuntu Server: Is it possible to auto-backup a catalog and MySQL database with adding to the archive and uploading to the cloud?

In general, the essence of the question title.
Are there ready-made solutions for such a request, and if not, how can such a thing be implemented, in which direction to look, etc.
PS Cloud - Yandex.Disk.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey, 2016-06-21
@GreeNYA

#! /bin/sh
to_cat=/backup
date_time=`date +"%Y-%m-%d_%H-%M-%S"`
echo Start Backup Process $date_time >> /var/log/vhc_backup.log
mysqldump - uwordpressuser -pPasswordHereBaseName > $to_cat/mysql_$date_time.sql
tar -cjf $to_cat/vhc_wordpress_$date_time.tar.bz2 $to_cat/mysql_$date_time.sql
rm $to_cat/mysql_$date_time.sql
tar -cjpf $to_cat/vhc_etc_ $date_time.tar.bz2 /etc /shscripts
tar -cjpf $to_cat/vhc_vmail_$date_time.tar.bz2 /var/vmail
tar -cjpf $to_cat/vhc_html_$date_time.tar.bz2 /var/www/html
date_time_end_arch=`date +"%Y-%m-%d_%H-%M-%S"`
echo End creating archives $date_time_end_arch >> /var/log/vhc_backup.log
# Delete backups older than 3 days
find $to_cat -name '*.gpg' -mtime +1 -delete
# Copy a backup archive to a remote FTP server
echo Start FTP Copying $date_time_end_arch >> /var/log/vhc_backup.log
ftpuser='UserName'
password='Password '
ftpserver='IP_Address'
file_etc=vhc_etc_$date_time.tar.bz2
file_vmail=vhc_vmail_$date_time.tar.bz2
file_html=vhc_html_$date_time.tar.bz2
file_mysql=vhc_wordpress_$date_time.tar.bz2
#Encrypt archives with gpg
gpg - e -r Key $to_cat/$file_etc
gpg -e -r Key $to_cat/$file_vmail
gpg -e -r Key $to_cat/$file_html
gpg -e -r Key $to_cat/$file_mysql
rm $to_cat/*.tar.bz2 #Open
FTP session
ftp -n $ftpserver << EOF
user $ftpuser $password
binary
put $to_cat/$file_etc.gpg /dayly_bkp/$file_etc.gpg
put $to_cat/$file_vmail.gpg /dayly_bkp/$file_vmail.gpg
put $to_cat/$file_html.gpg /dayly_bkp/$file_html. gpg
put $to_cat/$file_mysql.gpg /dayly_bkp/$file_mysql.gpg
bye
EOF
date_time_end_ftp=`date +"%Y-%m-%d_%H-%M-%S"`
echo End FTP Copying $date_time_end_ftp >> /var/log/vhc_backup.log
Upgrade at your discretion, I back up the contents of the folder with sites, the database, back up a couple of system directories, put them on the server and merge them to FTP, copies for 3 days are stored in the folder on the server....
I think if you fasten the synchronization services, then you can upload it to the cloud by deleting the section from FTP. Encryption is up to you.

S
Spetros, 2016-06-21
@Spetros

It is possible, for example, by scripts launched by cron.

P
Puma Thailand, 2016-06-21
@opium

Personally extra backup to take a snapshot of files works only for innodb, but in the cloud, load it with any cloud client that you like, for example, duplicity

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question