Created
December 7, 2012 09:34
-
-
Save mgratzer/4232138 to your computer and use it in GitHub Desktop.
Tiny shell script to backup WordPress on Dropbox. Schedule this script with cron and you'r done.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
NAME="blogname" | |
DIR="/var/www/blogfolder" | |
SQL="blogdatabase" | |
U="dbuser" | |
P="dbpassword" | |
NOW=$(date +"%m_%d_%Y") | |
FILE="$NAME.$NOW.tar.gz" | |
TARGET="/root/Dropbox/Backup/$FILE" | |
rm -Rf /tmp/wpbackup_$NAME | |
mkdir /tmp/wpbackup_$NAME | |
cd /tmp/wpbackup_$NAME | |
mysqldump --add-drop-table -u$U -p$P $SQL > $SQL.sql | |
cp $DIR . -Rf | |
tar -pczf $FILE . | |
mv $FILE $TARGET |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment