运行调用节点进程的bash脚本的已启动plist正在退出,状态码为8

时间:2022-11-17 01:07:52

Here is my launchd playlist

这是我推出的播放列表

   <?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.blockjunk.server.plist</string>
        <key>ProgramArguments</key>
        <array>
          <string>/Users/jeff/scripts/nojunkweb/startserver.sh</string>
        </array>
        <key>RunAtLoad</key>
          <true/>
        <key>KeepAlive</key>
          <true/>
    </dict>
    </plist>

And here is startserver.sh that it is calling

这是它正在调用的startserver.sh

#!/bin/bash

echo "Attempting to start node server"
/usr/local/bin/node /Users/jeff/scripts/nojunkweb/server.js "http://dynamic.xkcd.com/random/comic/" "https://www.shortcutfoo.com/app/drills" "https://www.duolingo.com" "http://*.com"

launchctl list shows error code 8 for com.blockjunk.server.plist - does anyone know status code 8 means or what I might be doing wrong?

launchctl列表显示com.blockjunk.server.plist的错误代码8 - 有谁知道状态代码8的意思或我可能做错了什么?

Here's the permissions on startserver.sh -rwxr-xr-x 1 jeff staff 248B Feb 6 10:16 startserver.sh

这是startserver.sh -rwxr-xr-x上的权限1 jeff staff 248B Feb 6 10:16 startserver.sh

The plist is in ~/Library/LaunchAgents/

plist在〜/ Library / LaunchAgents /中

2 个解决方案

#1


1  

Error code 8: Exec format error. A request was made to execute a file that, although it has the appropriate permissions, was not in the format required for an executable file.

错误代码8:Exec格式错误。已发出请求以执行一个文件,尽管该文件具有适当的权限,但该文件的格式不是可执行文件所需的格式。

Start the job manually from Terminal.app. What exactly is the error message?

从Terminal.app手动启动作业。究竟是什么错误信息?

1) Job failed to exec(3) for weird reason: 8: launchd was unable to execute the job specified in ProgramArguments. Given that you specified a proper bang line this is unlikely.

1)由于奇怪的原因,作业无法执行(3):8:launchd无法执行ProgramArguments中指定的作业。鉴于你指定了一个合适的爆炸线,这是不太可能的。

2) Exited with code: 8: The script launchd called returned this error. Try running the script manually. Does it work?

2)退出代码:8:调用脚本launchd返回此错误。尝试手动运行脚本。它有用吗?

It is important to know what exactly the error message is. Otherwise it is impossible to tell what error code 8 is because we do not know which process reported it. launchd reports standard error codes but software in general is not required to do that.

重要的是要知道错误消息究竟是什么。否则无法分辨出错误代码8是什么,因为我们不知道哪个进程报告了它。 launchd报告标准错误代码,但一般不需要软件。

To find out what a standard error code means enter the following command:

要找出标准错误代码的含义,请输入以下命令:

perl -E 'say $!=shift' 8

Just replace the 8 by the code you are looking for.

只需用您要查找的代码替换8即可。

#2


0  

I needed to put the plist in /Library/LaunchDeamons to run it as root because the node process needed root access.

我需要将plist放在/ Library / LaunchDeamons中以root身份运行它,因为节点进程需要root访问权限。

#1


1  

Error code 8: Exec format error. A request was made to execute a file that, although it has the appropriate permissions, was not in the format required for an executable file.

错误代码8:Exec格式错误。已发出请求以执行一个文件,尽管该文件具有适当的权限,但该文件的格式不是可执行文件所需的格式。

Start the job manually from Terminal.app. What exactly is the error message?

从Terminal.app手动启动作业。究竟是什么错误信息?

1) Job failed to exec(3) for weird reason: 8: launchd was unable to execute the job specified in ProgramArguments. Given that you specified a proper bang line this is unlikely.

1)由于奇怪的原因,作业无法执行(3):8:launchd无法执行ProgramArguments中指定的作业。鉴于你指定了一个合适的爆炸线,这是不太可能的。

2) Exited with code: 8: The script launchd called returned this error. Try running the script manually. Does it work?

2)退出代码:8:调用脚本launchd返回此错误。尝试手动运行脚本。它有用吗?

It is important to know what exactly the error message is. Otherwise it is impossible to tell what error code 8 is because we do not know which process reported it. launchd reports standard error codes but software in general is not required to do that.

重要的是要知道错误消息究竟是什么。否则无法分辨出错误代码8是什么,因为我们不知道哪个进程报告了它。 launchd报告标准错误代码,但一般不需要软件。

To find out what a standard error code means enter the following command:

要找出标准错误代码的含义,请输入以下命令:

perl -E 'say $!=shift' 8

Just replace the 8 by the code you are looking for.

只需用您要查找的代码替换8即可。

#2


0  

I needed to put the plist in /Library/LaunchDeamons to run it as root because the node process needed root access.

我需要将plist放在/ Library / LaunchDeamons中以root身份运行它,因为节点进程需要root访问权限。