为什么我的Mac下的launchctl不执行?
这是我的plist文件,放在了~/Library/LaunchAgents下面。
<?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>lee.test.sh</string>
<key>ProgramArguments</key>
<array>
<string>/Users/lee/sh/my.sh</string>
</array>
<key>StartInterval</key>
<integer>10</integer>
</dict>
</plist>
我把执行周期变成了StartCalendarInterval也不行
<?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>lee.test.sh</string>
<key>ProgramArguments</key>
<array>
<string>/Users/lee/sh/my.sh</string>
</array>
<key>StartCalendarInterval</key>
<dict>
<key>Minute</key>
<integer>36</integer>
<key>Hour</key>
<integer>13</integer>
</dict>
</dict>
</plist>
然后执行的脚本文件是
#!/bin/bash
echo "hello" > /Users/lee/hello
脚本文件权限是777了,如果手动执行脚本文件是可以执行的,但是就是不能定时,到底哪里出问题了?
已经解决了,发现是自己路径多加了个空格