Skip to content

Instantly share code, notes, and snippets.

@stevestreza
Created March 16, 2009 15:55
Show Gist options
  • Save stevestreza/79935 to your computer and use it in GitHub Desktop.
Save stevestreza/79935 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.stevestreza.iTunesBackup</string>
<key>Nice</key>
<integer>12</integer>
<key>OnDemand</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>/local/path/to/rsync-itunes.sh</string>
</array>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>3</integer>
<key>Minute</key>
<integer>0</integer>
</dict>
</dict>
</plist>
#! /bin/sh
RSYNC=/usr/bin/rsync
SSH=/usr/bin/ssh
KEY=/local/path/to/.ssh/rsync-itunes
RUSER=myuser
RHOST=myhost
RPORT=22 #I use a custom port for NAT-busting.
RPATH=/remote/path/to/iTunes
LPATH=/local/path/to/iTunes
TWEETNOTIFY=/path/to/tweetnotify
$RSYNC -qaEz -e " $SSH -i $KEY -p $RPORT" "$RUSER@$RHOST:$RPATH" $LPATH
# this checks the exit code of the rsync process
# if 0, assume success, otherwise assume failure
if [ $? -eq 0 ]; then
$TWEETNOTIFY "iTunes music backup succeeded"
else
$TWEETNOTIFY "ERROR: iTunes music backup FAILED"
fi
#! /bin/bash
USERNAME="myusername"
PASSWORD="mypassword"
curl --basic --user $USERNAME:$PASSWORD --data status="$1" http://twitter.com/statuses/update.xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment