Skip to content

Instantly share code, notes, and snippets.

@brainsatwork
Created April 28, 2011 11:40
Show Gist options
  • Save brainsatwork/946192 to your computer and use it in GitHub Desktop.
Save brainsatwork/946192 to your computer and use it in GitHub Desktop.
Mac Synchronisation
<?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>org.brainsatwork.sync</string>
<key>ProgramArguments</key>
<array>
<string>~/.sync/sync.sh</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StandardErrorPath</key>
<string>~/.sync/error.log</string>
<key>StandardOutPath</key>
<string>~/.sync/sync.log</string>
<key>StartInterval</key>
<integer>600</integer>
</dict>
</plist>
#!/bin/bash
#check if ssh connection is available
ssh [email protected] exit
if [ `echo $?` = "0" ]; then
rsync -auq --exclude '.*' /yourLocalFolderPath/ targetMacName.local:/yourTargetFolderPath/
rsync -auq --exclude '.*' targetMacName.local:/ourTargetFolderPath/ /yourLocalFolderPath/
else
#echo `date` no connection >> ~/.bawsync/sync.log
fi
#!/bin/bash
#check if ssh connection is available
ssh [email protected] exit
if [ `echo $?` = "0" ]; then
rsync -auvv --exclude '.*' /yourLocalFolderPath/ targetMacName.local:/yourTargetFolderPath/ >> /.bawsync/sync.log
rsync -auvv --exclude '.*' targetMacName.local:/ourTargetFolderPath/ /yourLocalFolderPath/ >> /.bawsync/sync.log
else
echo `date` no connection >> ~/.bawsync/error.log
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment