Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Launchd script running but output is missing (Exited with code: 2)

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?

like image 434
Bernd Avatar asked Nov 03 '22 23:11

Bernd


1 Answers

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.

like image 190
Parag Bafna Avatar answered Nov 09 '22 12:11

Parag Bafna