Why doesn't my launchd plist work as expected? How to troubleshoot?
I have the following plist file as ~/Library/LaunchAgents/wealthychef.obsidian-daily.plist. I'm wondering why it does not execute when loaded. I feel like it should run every minute from 18:00 to 18:59 as written, and if the computer is asleep at those times, then it should run when the computer wakes up... yet it does not. It does not run at all, even though I am always logged in on the machine. Can someone help me understand what I'm doing wrong? Thank you.
<?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>wealthychef.obsidian-daily</string>
<key>Program</key>
<string>/Users/rcook/bin/obsidian-daily.sh</string>
<key>StandardErrorPath</key>
<string>/Users/rcook/bin/log/obsidian-daily.err</string>
<key>StandardOutPath</key>
<string>/Users/rcook/bin/log/obsidian-daily.out</string>
<key>StartCalendarInterval</key>
<dict>
<!--Missing arguments are considered wildcards-->
<key>Hour</key>
<integer>18</integer>
</dict>
</dict>
</plist>
I have validated it and loaded it:
rcook: launchctl unload ~/Library/LaunchAgents/wealthychef.obsidian-daily.plist
rcook: launchctl load ~/Library/LaunchAgents/wealthychef.obsidian-daily.plist
rcook: plutil ~/Library/LaunchAgents/wealthychef.obsidian-daily.plist
/Users/rcook/Library/LaunchAgents/wealthychef.obsidian-daily.plist: OK
The script /Users/rcook/bin/obsidian-daily.sh exists and is executable and works as expected when launched from the Terminal. Here are its contents. The command in the script worked fine when executed from a cron job. Cron won't run if the Mac is asleep, so I want to use launchd, which I am told should run when the Mac wakes up. In fact, this plist doesn't run at all, awake or asleep. The funky URL I'm opening is to be launched by Obsidian.md app.
#!//usr/bin/env bashecho "It is running on $(date)" > ${HOME}/script-turd.txt
open 'obsidian://advanced-uri?vault=wealthyvault&daily=true&mode=prepend'
I don't know how to troubleshoot any further. Thanks for any help.
MacBook Pro 16″