简体   繁体   English

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

[英]running node.js server using upstart causes 'terminated with status 127' on 'ubuntu 10.04'

i have written an upstart script for ubuntu to launch my node.js server manually or on startup. 我为ubuntu编写了一个upstart脚本,手动或在启动时启动我的node.js服务器。 But it always terminates with status 127 and i can't find more information about what is going wrong. 但它始终以状态127终止,我无法找到有关出错的更多信息。 If i execute it manually then it works and i also tested it on ubuntu 12.10 where it also works ... it only fails to work on ubuntu 10.04 which is the production server i'm using. 如果我手动执行它然后它工作,我也在ubuntu 12.10测试它,它也工作...它只能无法在我正在使用的生产服务器ubuntu 10.04上工作。

The script: 剧本:

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

any idea where to find more information about the status 127? 任何想法在哪里可以找到有关状态127的更多信息? Or how i can fix this? 或者我如何解决这个问题? i have looked in /var/log/daemon.log and in /var/log/syslog.log .. but there is no relevant info except for 'main process (29520) terminated with status 127'. 我查看了/var/log/daemon.log和/var/log/syslog.log ..但除了'主进程(29520)以状态127终止'之外没有相关信息。

kind regards, 亲切的问候,

Daan 大安

127 in bash means: "command not found", illegal_command, possible problem with $PATH or a typo. bash中的127表示:“命令未找到”,illegal_command,$ PATH可能出现问题或输入错误。

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

This might be a question for server fault, as it is bash related, but this question / answer might help you: 这可能是服务器故障的问题,因为它与bash相关,但是这个问题/答案可能对您有所帮助:

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

Had the same error messages, tracked it down in custom upstart log that failed with /usr/bin/env: node: No such file or directory , this was my fix: 有相同的错误消息,在使用/usr/bin/env: node: No such file or directory自定义upstart日志中跟踪它/usr/bin/env: node: No such file or directory ,这是我的修复:

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

Had this issue. 有这个问题。 I am deploying web app with gunicorn in ubuntu server 14.04. 我正在ubuntu服务器14.04中使用gunicorn部署web应用程序。 Move your core instructions to a bash script. 将核心指令移动到bash脚本。 And remember to make the script executable. 并记住使脚本可执行。 I had neglected to make the bash script executable and so I was getting the 127. 我忽略了使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/

then my 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 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM