Launchd script works, but no output (Output with code: 2)

I try to execute a script every minute using launchd

I added a new jobd plugin that looks like this

<?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.bpstatusboard.omnifocus</string>
    <key>ProgramArguments</key>
    <array>
        <string>/Users/me/script.sh</string>
    </array>
    <key>StartInterval</key>
    <integer>50</integer>
</dict>
</plist>

The task runs at the specified time interval and generates the next log.

Apr 19 15:27:58 MacBook com.apple.launchd.peruser.501[153] (com.bpstatusboard.omnifocus[89895]): Exited with code: 2

Problem: the script should update the file, but it is not. It works correctly when I run it manually in the terminal. I could not find more detailed information on the code output : 2 . Any idea what stops the script from executing correctly?

+5
source share
1 answer

Output with code: 2

2 ENOENT No such file or directory. The component of the specified pathname does not exist, or the path name was an empty string.

script /Users/me/ script.sh.

+2

All Articles