LaunchAgent plist配置完全不执行的问题求助
LaunchAgent plist配置完全不执行的问题求助
我在~/Library/LaunchAgents/wealthychef.obsidian-daily.plist路径下有如下plist文件,想不通为什么加载后完全不执行。按照我的理解,它应该在每天18:00到18:59之间每分钟运行一次,而且如果电脑在这段时间休眠的话,唤醒后也应该补执行,但实际情况是它根本没运行过——我一直保持登录状态,却完全没看到它的执行痕迹。有没有大佬能帮我找找问题出在哪?谢谢!
<?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>
我已经验证过plist的有效性,也完成了加载操作:
launchctl unload ~/Library/LaunchAgents/wealthychef.obsidian-daily.plist launchctl load ~/Library/LaunchAgents/wealthychef.obsidian-daily.plist plutil ~/Library/LaunchAgents/wealthychef.obsidian-daily.plist
执行plutil后的输出是:
/Users/rcook/Library/LaunchAgents/wealthychef.obsidian-daily.plist: OK
脚本/Users/rcook/bin/obsidian-daily.sh确实存在,而且有可执行权限,在终端里直接运行完全没问题。之前用cron跑这个脚本里的命令是正常的,但cron在电脑休眠时不会执行,所以我换成launchd,想着它应该能在电脑唤醒后补执行,结果现在不管电脑醒着还是休眠,都完全没运行过。脚本里那个看起来奇怪的URL是给Obsidian.md用的高级URI。
脚本内容如下:
#!//usr/bin/env bash echo "It is running on $(date)" > ${HOME}/script-turd.txt open 'obsidian://advanced-uri?vault=wealthyvault&daily=true&mode=prepend'
备注:内容来源于stack exchange,提问作者Rich
相关产品推荐
相关产品推荐

