5

I am trying to execute a script about every minute using launchd

I added a new launchd job plist 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 job is executed with the given time interval and generates the following 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 a file but it's not. It's working correctly when I launch it manually in terminal. I couldn't find more details on exit code: 2. Any idea what stops the script to execute correctly?

1
  • Very hard to say without knowing anything about what's in the script; see this previous answer for some troubleshooting options. Commented Apr 19, 2013 at 14:39

1 Answer 1

2

Exited with code: 2

2 ENOENT No such file or directory. A component of a specified pathname did not exist, or the pathname was an empty string.

Your script does not exist at /Users/me/script.sh.

Sign up to request clarification or add additional context in comments.

1 Comment

Actually this is wrong.The script was found and executed. Some command in the script returned code 2. Had launchd not found the script it would have complained like this: Job failed to exec(3) for weird reason: 2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.