Skip to content

Instantly share code, notes, and snippets.

@the-codinator
Created November 14, 2020 12:32
Show Gist options
  • Save the-codinator/cd164a31784990384ee2c6f8ece90999 to your computer and use it in GitHub Desktop.
Save the-codinator/cd164a31784990384ee2c6f8ece90999 to your computer and use it in GitHub Desktop.
launchd driver script for auto-commit.sh
<!-- Data backup launchd agent for work directory -->
<?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>org.codi.backup.work</string>
<key>WorkingDirectory</key>
<string>/Users/ppanchal/Documents/work</string>
<key>ProgramArguments</key>
<array>
<string>/Users/ppanchal/Documents/work/.auto-commit.sh</string>
<string>.</string>
</array>
<key>ExitTimeOut</key>
<integer>60</integer>
<!-- Every weekday at 2 pm IST (0830 UTC) -->
<key>StartCalendarInterval</key>
<array>
<dict>
<key>Hour</key>
<integer>8</integer>
<key>Minute</key>
<integer>30</integer>
<key>Weekday</key>
<integer>1</integer>
</dict>
<dict>
<key>Hour</key>
<integer>8</integer>
<key>Minute</key>
<integer>30</integer>
<key>Weekday</key>
<integer>2</integer>
</dict>
<dict>
<key>Hour</key>
<integer>8</integer>
<key>Minute</key>
<integer>30</integer>
<key>Weekday</key>
<integer>3</integer>
</dict>
<dict>
<key>Hour</key>
<integer>8</integer>
<key>Minute</key>
<integer>30</integer>
<key>Weekday</key>
<integer>4</integer>
</dict>
<dict>
<key>Hour</key>
<integer>8</integer>
<key>Minute</key>
<integer>30</integer>
<key>Weekday</key>
<integer>5</integer>
</dict>
</array>
</dict>
</plist>
<!--
Docs:
https://medium.com/swlh/how-to-use-launchd-to-run-services-in-macos-b972ed1e352
https://www.unix.com/man-page/osx/5/launchd.plist/
https://en.wikipedia.org/wiki/Property_list#Format
Debug:
launchctl list | grep org.codi.backup.work
launchctl debug gui/$UID/org.codi.backup.work --stdout --stderr
launchctl kickstart gui/$UID/org.codi.backup.work
launchctl kill gui/$UID/org.codi.backup.work
Registration:
launchctl bootstrap gui/$UID ~/Library/LaunchAgents/org.codi.backup.work.plist
launchctl bootout gui/$UID/org.codi.backup.work
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment