Skip to content

Instantly share code, notes, and snippets.

@nalexn
Created May 17, 2020 21:56
Show Gist options
  • Save nalexn/8a7cbd2ea64535c3ee0798ec31c0732b to your computer and use it in GitHub Desktop.
Save nalexn/8a7cbd2ea64535c3ee0798ec31c0732b to your computer and use it in GitHub Desktop.
Setting up rsync with LaunchAgent
<?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.rsync.backup</string>
<key>ProgramArguments</key>
<array>
<string>open</string>
<string>-a</string>
<string>/Users/me/scripts/rsync_run.app</string>
</array>
<key>StartInterval</key>
<integer>300</integer>
</dict>
</plist>
#!/usr/bin/env sh
# Path to the backup destination directory:
backup_dest="/Users/me/Library/.../Backups/backup"
# Check if the cloud storage is mounted:
if [ -d "$backup_dest" ]
then
# Start the backup:
rsync -abuv --delete --no-l --backup-dir="backup_$(date +%Y-%m-%d_%H-%M-%S)" --exclude-from="/Users/me/scripts/rsync_exclude.txt" "/Users/me/Documents/MyActiveProject" "$backup_dest"
fi
# Development
- Carthage
- Pods
- xcuserdata
- .DS_Store
- .git
- .ipa
- .dSYM.zip
- .dSYM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment