Created
June 18, 2019 06:28
-
-
Save unkwn1-repo/11c77a0a86c2f0952d68198194daae7b to your computer and use it in GitHub Desktop.
An example launchd plist file. The launchd agent will first change the working directory, set the arguements and, execute a python script. This is a minimalist launchd template that can easily be expanded upon.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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.nuntium.fetchnews.agent</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/usr/local/bin/python3</string> | |
<string>nuntium.py</string> | |
<string>--fetch-news</string> | |
</array> | |
<key>RunAtLoad</key> | |
<true/> | |
<key>StartInterval</key> | |
<integer>600</integer> | |
<key>WorkingDirectory</key> | |
<string>/Users/jessefogarty/Google Drive/github/nuntium/nuntium</string> | |
</dict> | |
</plist> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I wrote this in order to automate my Nuntium project. Oh how I relish crontab so much more after this.
end result is akin to running:
$ cd /Users/jessefogarty/Google Drive/github/nuntium/nuntium $ python3 nuntium.py --fetch-news
every 10 minutes.
Where to install your plist file
~/Library/LaunchAgents/
Loading your plist file
Default logs
When checking the system.log output you know you plist was loaded fine IF there's no error to check run:
Feel free to include a snippet of your plist code if you're having trouble and I'll do my best to help you fix it.
Enjoy!