Unison OS X launchd plist

unison_sync.sh

#!/bin/bash
pref=my_unison_pref
pid=`pgrep unison`

[ -z $pid ] && $HOME/bin/unison $pref -auto -batch

unison_sync.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>Label</key>
    <string>unison_sync</string>
    <key>ProgramArguments</key>
    <array>
      <string>/Users/MY_USER/bin/unison_sync.sh</string>
    </array>
    <key>StandardOutPath</key>
    <string>/Users/MY_USER/Library/Logs/unison_sync.log</string>
    <key>StandardErrorPath</key>
    <string>/Users/MY_USER/Library/Logs/unison_sync.err</string>
    <key>LowPriorityIO</key>
    <true/>
    <key>Nice</key>
    <integer>1</integer>
    <key>StartInterval</key>
    <integer>300</integer>
  </dict>
</plist>
 
$ cd ~/Library/LaunchAgents
$ plutil -lint unison_sync.plist
unison_sync.plist: OK
$ launchctl load unison_sync.plist

Tags: 

Add new comment

Plain text

  • No HTML tags allowed.
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.