Skip to content

Instantly share code, notes, and snippets.

@richardhsu

richardhsu/backup.sh

Created May 31, 2014
Embed
What would you like to do?
Quick backup script to backup my minecraft server folder and potentially other folders to Dropbox.
#!/bin/bash
# Backup folders to DropBox
# Add folder names relative to home directory.
# This file exists at the home directory level.
DATE=`date +%Y-%m-%d-%H-%M`
FOLDERS=("minecraft")
DROPBOX="/home/richardhsu/.dropbox/dropbox.py"
for dir in "${FOLDERS[@]}"
do
echo "Working on $dir"
BACKUP_F="Dropbox/Backup/$dir-$DATE.tar.gz"
tar -czf $BACKUP_F $dir
done
python $DROPBOX start
sleep 5 # Wait for dropbox to start
while [[ $(python $DROPBOX status) != "Up to date" ]]; do
sleep 5 # Sleep 5 seconds then check status again
done
python $DROPBOX stop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment