1

I'm trying to set up a simple repeating task with launchd on OS X. My plist file is in /Users/me/Library/LaunchAgents and all I want it to do is run the command node --version. My plist file 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.blah.testnode</string>
    <key>ProgramArguments</key>
    <array>
        <string>node</string>
        <string>--version</string>
    </array>
    <key>StartInterval</key>
    <integer>300</integer>
</dict>
</plist>

It printed out the right response when I ran launchctl load com.blah.testnode.plist but now it looks like each subsequent execution is giving me the following error:

8/24/14 1:54:03.845 PM com.apple.launchd.peruser.501[251]: (com.blah.testnode[36483]) Job failed to exec(3). Setting up event to tell us when to try again: 2: No such file or directory

8/24/14 1:54:03.845 PM com.apple.launchd.peruser.501[251]: (info.jayharris.testnode[36483]) Job failed to exec(3) for weird reason: 2

Does anybody know how to get this to work? Thanks.

1
  • Were you able to find an answer to this? If so, please feel free to enlighten us. Commented Feb 19, 2016 at 13:50

2 Answers 2

1

I ran into a similar problem with launching a node app from a LaunchAgent .plist. Launchctl requires the full path to a binary or script in order to execute said file. The solution, then, is to ensure you're providing the exact directory to node. For example, since I installed node with homebrew, I specify the full path /usr/local/bin/node.

0

Have a exec file that is basically a self hosting service. It triggers without problems when I run it from Terminal with the code

/Users/user/Public/node_modules/codem-transcode/bin/codem-transcode -c /Users/user/Public/tmp/config.json

So I created a plist script that I want to run on startup, and I stored it in the LaunchAgent folder. Upon running it, I get the "No such file or directory" error.

Here is a picture showing almost all the information I have

Everything

And here is the plist in code

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

<plist version="1.0">
    <dict>
        <key>KeepAlive</key>
        <dict>
            <key>SuccessfulExit</key>
            <false/>
        </dict>
        <key>Label</key>
        <string>com.wolftech.transcode.job</string>
        <key>RunAtLoad</key>
        <true/>
        <key>StandardErrorPath</key>
        <string>/tmp/com.wolftech.transcode.job.err</string>
        <key>StandardOutPath</key>
        <string>/tmp/com.wolftech.transcode.job.out</string>
        <key>StartInterval</key>
        <integer>60</integer>
        <key>ProgramArguments</key>
        <array>
            <string>/Users/user/Public/node_modules/codem-transcode/bin/codem-transcode -c /Users/user/Public/tmp/config.json</string>
        </array>
    </dict>
</plist>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .