Skip to content

Instantly share code, notes, and snippets.

@richardhsu
Created May 31, 2014 21:50
Show Gist options
  • Save richardhsu/0fc52989d6d639466052 to your computer and use it in GitHub Desktop.
Save richardhsu/0fc52989d6d639466052 to your computer and use it in GitHub Desktop.
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