Skip to content

Instantly share code, notes, and snippets.

@bgrand-ch
Last active March 29, 2021 12:44
Show Gist options
  • Save bgrand-ch/a72a9042fb54b803f018bd7fce57ff80 to your computer and use it in GitHub Desktop.
Save bgrand-ch/a72a9042fb54b803f018bd7fce57ff80 to your computer and use it in GitHub Desktop.
MacOS -> {username} -> Library -> LaunchAgents
<!--
Backup files in the `Documents` folder to the NAS.
@see https://www.launchd.info/
@see https://www.cis.upenn.edu/~bcpierce/unison/download/releases/stable/unison-manual.html
@see https://linux.developpez.com/unison/
@see http://xahlee.info/UnixResource_dir/unison_file_sync.html
@see https://superuser.com/questions/1272832/how-do-i-ignore-folders-and-its-subdirectories-in-unison-sync
@see https://superuser.com/questions/1166185/making-unison-ignore-file-property-differences
-->
<?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>local.nas.backup-documents</string>
<key>RunAtLoad</key>
<false/>
<key>StartOnMount</key>
<true/>
<key>KeepAlive</key>
<false/>
<key>StartInterval</key>
<integer>1200</integer>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/unison</string>
<string>/Users/{username}/Documents/</string>
<string>/Volumes/{folder_name}</string>
<string>-auto</string>
<string>-batch</string>
<string>-fastcheck=true</string>
<string>-perms=0</string>
<string>-dontchmod=true</string>
<string>-times=true</string>
<string>-log=false</string>
<string>-retry=3</string>
<string>-ignore=Name .DS_Store</string>
<string>-ignore=Name .tscache</string>
<string>-ignore=Name .git</string>
<string>-ignore=Name vendor</string>
<string>-ignore=Name platforms</string>
<string>-ignore=Name node_modules</string>
</array>
<key>StandardErrorPath</key>
<string>/Users/{username}/local.nas.backup-documents.stderr</string>
<!--<key>StandardOutPath</key>
<string>/Users/{username}/local.nas.backup-documents.stdout</string>-->
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment