wget https://raw.github.com/andreafabrizi/Dropbox-Uploader/master/dropbox_uploader.sh
chmod +x dropbox_uploader.sh
./dropbox_uploader.sh info
vi backup.sh
#!/bin/bash
SCRIPT_DIR="/root"
DROPBOX_DIR="/ovh_zq_1"
BACKUP_SRC="/var/www"
BACKUP_DST="/tmp"
NOW=$(date +"%Y.%m.%d")
DATEM=$(date +"%Y_%m")
DESTFILE="$BACKUP_DST/$NOW.tar.gz"
tar cfz "$DESTFILE" $BACKUP_SRC
$SCRIPT_DIR/dropbox_uploader.sh upload "$DESTFILE" "$DROPBOX_DIR/$DATEM/$NOW.tar.gz"
rm -f "$DESTFILE"
cron来做定时任务
crontab -e
0 5 * * * /bin/bash /root/backup.sh
/etc/rc.d/init.d/crond restart
文章评论