VPS自动备份到Dropbox脚本

连接到Dropbox需要一个脚本:Dropbox-Uploader

然后配合下面的脚本就可以自动备份到Dropbox了

1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/bash
dt=`date +"%Y%b%d"`
dir=/root/backup
mkdir $dir/$dt
cd $dir/$dt
tar zcf home_$dt.tar.gz /home
tar zcf conf_$dt.tar.gz /usr/local/nginx/conf
/usr/local/mysql/bin/mysqldump -uroot -ppassword --all-databases > db_$dt.sql
../dropbox_uploader.sh mkdir $dt
../dropbox_uploader.sh upload db_$dt.sql /$dt/db_$dt.sql
../dropbox_uploader.sh upload conf_$dt.tar.gz /$dt/conf_$dt.tar.gz
../dropbox_uploader.sh upload home_$dt.tar.gz /$dt/home_$dt.tar.gz

Comments