簡體   English   中英

使用upstart運行node.js服務器會導致'ubuntu 10.04'上的狀態為127'

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

我為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終止'之外沒有相關信息。

親切的問候,

大安

bash中的127表示:“命令未找到”,illegal_command,$ PATH可能出現問題或輸入錯誤。

資料來源: http//tldp.org/LDP/abs/html/exitcodes.html

這可能是服務器故障的問題,因為它與bash相關,但是這個問題/答案可能對您有所幫助:

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

有相同的錯誤消息,在使用/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

有這個問題。 我正在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 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM