Skip to content

Instantly share code, notes, and snippets.

@githubber
Forked from n2j3/backup.sh
Created September 16, 2016 12:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save githubber/a0fc2b20fe8f820d23c9fac87574f33d to your computer and use it in GitHub Desktop.
Save githubber/a0fc2b20fe8f820d23c9fac87574f33d to your computer and use it in GitHub Desktop.
simplified backup script utilising Fabrizi's dropbox uploader. Based on Dave Hope's backup script ( http://davehope.co.uk/Blog/backup-your-linux-vps-to-dropbox/ )
#!/bin/bash
BACKUP_SRC="/root /etc /home"
BACKUP_DST="/tmp"
MYSQL_SERVER="127.0.0.1"
MYSQL_USER="mysql username"
MYSQL_PASS="mysql password"
#VPS_ID="vpsidentifier"
# Stop editing here.
NOW=$(date +"%Y.%m.%d")
DESTFILE="$BACKUP_DST/$NOW.tgz"
#DESTFILE="$BACKUP_DST/$VPS_ID.$NOW.tgz
# Backup files.
mysqldump -u $MYSQL_USER -h $MYSQL_SERVER -p$MYSQL_PASS --all-databases > "$NOW-Databases.sql"
tar cfz "$DESTFILE" $BACKUP_SRC "$NOW-Databases.sql"
#upload to dropbox. make sure the following line points to the correct dropbox_uploader.sh location
/root/dropbox_uploader.sh upload "$DESTFILE"
#remove temporary files
rm -f "$NOW-Databases.sql" "$DESTFILE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment