Skip to content

Instantly share code, notes, and snippets.

@vasilisvg
Last active December 4, 2020 04:48
Show Gist options
  • Star 78 You must be signed in to star a gist
  • Fork 17 You must be signed in to fork a gist
  • Save vasilisvg/2415901 to your computer and use it in GitHub Desktop.
Save vasilisvg/2415901 to your computer and use it in GitHub Desktop.
This is my backup script which syncs my server to my dropbox every day.

The script below is triggered every day from my Mac. I use Hazel to move the tar.gz to an external hard disk once it's finished. This happens every day without me noticing. You can exclude folders if you want to. You probably want to exclude giant cache folders.

You should have a similar script.

rsync --exclude="w3tc/" -a --del -e ssh user@example.com:~/webdirectory/ ~/myname/Dropbox/Backups/webapps
cd ~/myname/Dropbox/Backups/webapps
dt=$(date +%y%j)
tar czf webapps$dt.tar.gz webapps
@matthewlein
Copy link

Curious: How you get it to ssh login without having to enter a password? I know I've seen people do this, but don't remember how.

@vasilisvg
Copy link
Author

@ducban
Copy link

ducban commented Apr 21, 2012

Please tell me how to trigger the script on Mac. :)

@seyDoggy
Copy link

You can make a crontab entry or a StartupItems.

@zhogan85
Copy link

Thanks for this, my host doesn't play nicely with WordPress backup plugins, but this script seems like its a great workaround.

@rutger1140
Copy link

My cpu would go skyrocket after I installed this script, when doing a backup with TimeMachine.

opendirectoryd used over 50% of my CPU.

Seems TimeMachine chokes on the symlinks of Dropbox.

Find and delete them with find -L ~/Dropbox -type l.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment