Skip to content

Instantly share code, notes, and snippets.

@jpfinley
Last active March 7, 2017 14:20
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 jpfinley/5940291 to your computer and use it in GitHub Desktop.
Save jpfinley/5940291 to your computer and use it in GitHub Desktop.
Some crazy tricks to automate by backup processes. This is the contents of an OS X Automator workflow.

Make sure the external drives are mounted (AppleScript)

try
  do shell script "ls /Volumes/Terrabyte/"
  do shell script "ls /Volumes/TerrabyteTwo/"
on error
  display dialog "External drive not mounted."
  error number -128 #supposedly kills the current Automator workflow
end try

Retrieve Pinboard posts; place into first drive (bash)

/usr/bin/curl https://XXXXX:XXXXX@api.pinboard.in/v1/posts/all?format=json -o /Volumes/Terrabyte/Recovery/Bookmarks/pinboard_backup.json

Retrieve NewsBlur Feeds OPML; place into first drive (bash)

curl -d "username=XXXXX&password=XXXXX" --cookie-jar cookies.txt -i -X POST https://www.newsblur.com/api/login
curl -b cookies.txt -o NewsBlur_$(date +"%Y-%m-%d").opml https://www.newsblur.com/import/opml_export

Retrieve music library metadata; place into first drive (bash)

Excluding music files in the home library because everything should be in the external drive.

rsync -lptgoDv --exclude-from=/Volumes/Terrabyte/backup-excludes.txt /Users/jpfinley/Music/iTunes/iTune* /Volumes/Terrabyte/iTunes/

Duplicate first drive (AppleScript)

do shell script "rsync -a --delete --exclude-from=/Volumes/Terrabyte/backup-excludes.txt /Volumes/Terrabyte/ /Volumes/TerrabyteTwo/" with administrator privileges
*/.Trash
.Spotlight-*/
.*.mp3
.*.aac
.DS-Store
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment