使用upstart运行node.js服务器会导致'ubuntu 10.04'上的状态为127'

时间:2013-02-04 18:12:20

标签: node.js ubuntu-10.04 upstart

我为ubuntu编写了一个upstart脚本,手动或在启动时启动我的node.js服务器。但它始终以状态127结束,我无法找到有关出错的更多信息。如果我手动执行它然后它工作,我也测试它在ubuntu 12.10,它也工作...它只能无法在ubuntu 10.04上工作,这是我正在使用的生产服务器。

剧本:

description ""
author      ""

start on started mountall
stop on shutdown
respawn
respawn limit 20 5

# Max open files are @ 1024 by default. Bit few.
limit nofile 32768 32768

env HOME=/home/projects/<project_name>/data/current

script
    export HOME=$HOME
    chdir $HOME
    exec sudo -u <user_to_launch_the_script> /usr/bin/node /home/projects/<project_name>/data/current/server.js 2>&1 >> /var/log/node.log
end script

任何想法在哪里可以找到有关状态127的更多信息?或者我如何解决这个问题?我查看了/var/log/daemon.log和/var/log/syslog.log ..但没有相关信息,除了主进程(29520)以状态127&#39;终止。 / p> 亲切的问候,

大安

3 个答案:

答案 0 :(得分:11)

127 in bash表示:“命令未找到”,illegal_command,$ PATH可能出现问题或输入错误。

来源:http://tldp.org/LDP/abs/html/exitcodes.html

这可能是服务器故障的问题,因为它与bash有关,但这个问题/答案可能会对你有所帮助:

https://serverfault.com/questions/277706/cron-fails-with-exit-status-127

答案 1 :(得分:0)

有相同的错误消息,在/usr/bin/env: node: No such file or directory失败的自定义启动日志中跟踪它,这是我的修复:

https://github.com/joyent/node/issues/3911

答案 2 :(得分:0)

有这个问题。我正在ubuntu服务器14.04中使用gunicorn部署web应用程序。 将核心指令移动到bash脚本。并记住使脚本可执行。我忽略了使bash脚本可执行,所以我得到了127。

description "Gunicorn  app running myproject"

start on runlevel [2345]
stop on runlevel [!2345]

respawn

setuid <user> 
setgid <group>

exec bash /path/to/bash/script/

然后是我的bash脚本

#!/bin/bash
# description "bash script that handles loading env and running gunicorn"

# load up the project's virtualenv 
source /path/to/virtualenv/bin/activate

# minimal settings 
exec gunicorn app:app 
相关问题