使用upstart运行node.js服务器导致“在Ubuntu 10.04上终止状态127”
我已经写了一个Ubuntu的新贵脚本来手动启动我的node.js服务器或启动。 但它总是终止状态127,我不能find更多的信息是什么问题。 如果我手动执行它然后它的工作原理,我也testing了它在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
任何想法在哪里可以find有关状态127的更多信息? 或者我该如何解决这个问题? 我已经看了/var/log/daemon.log和/var/log/syslog.log ..但没有相关的信息,除了'主进程(29520)终止状态127'。
亲切的问候,
大安
127在bash中的意思是:“找不到命令”,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
,这是我的修复:
有这个问题。 我正在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