Skip to content

Instantly share code, notes, and snippets.

@OKNoah
Created June 14, 2014 00:05
Show Gist options
  • Save OKNoah/da97f9e074adea15a0ef to your computer and use it in GitHub Desktop.
Save OKNoah/da97f9e074adea15a0ef to your computer and use it in GitHub Desktop.
Transfer files to Dropbox - Upload and delete locally.
#!/bin/bash
#
# This backs-up to Dropbox without leaving files locally.
# A local .tar.gz is made, uploaded, then removed. This saves
# space locally when keeping many backups.
#
# Requires: Dropbox-Uploader from https://github.com/andreafabrizi/Dropbox-Uploader
#
# Install and setup Dropbox-Uploader first!
#
#
# Format: YEAR MONTH DAY - HOUR MINUTE SECOND
#
DATE=$(date +%Y%m%d-%H%M%S)
#
# Folders to archive. Seperate by space. Format - "/var/www /var/vmail"
#
SOURCES="/var/www /var/lib/mysql"
#
# Destination in Dropbox. Format - Do not include path to Dropbox,
# eg. "/backsup/archives"
#
DEST="/backups"
#
# Dropbox Uploader location. Get from GitHub and setup.
#
DU="/root/scripts/Dropbox-Uploader/dropbox_uploader.sh"
#
# Temporary directory. Make sure it exists (mkdir to make). Format - "/root/"
#
TEMP="/root/temporary"
#
# DON'T EDIT BELOW
#
tar -czvf $TEMP/daily-${DATE}.tar.gz $SOURCES
/bin/bash $DU upload $TEMP/daily-${DATE}.tar.gz $DEST
rm -v $TEMP/daily-${DATE}.tar.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment