LaunchD Plist not working

99封情书 提交于 2019-12-06 09:30:52

Exit code 1 means the script exited with an error condition. If it exited with a 0 it would mean there were no errors.

Chuck

Well, I finally worked through my problem and have found a solution! I'm going to post the answer here in order to hopefully help someone else someday! It seems as if the launchd file wasn't running long enough to run my entire script. So I added the KeepAlive key to the plist. It looks like this now.

<?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.xxxx.adbind</string>
    <key>KeepAlive</key>
    <dict>
        <key>SuccessfulExit</key>
        <false/>
    </dict>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/local/bin/adbind.bash</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>

I also had troubles with permissions and found that the "bin" folder I created and placed the script into wasn't owned by root. So I ran chown and chmod on my files and folders. Like this.

sudo chown root:wheel bin
sudo chown root:wheel adbind.bash
sudo chmod 755 adbind.bash
sudo chown root:wheel com.xxxx.adbind.plist
sudo chmod 755 com.xxxx.adbind.plist
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!