【发布时间】:2014-08-05 02:42:50
【问题描述】:
我可以手动运行我的 /etc/rc.local 文件,它在启动时运行(将字符串回显到文件),但永远(npm 包)由于某种原因失败。如果有帮助,我将在 EC2 实例上运行 Amazon Linux AMI。
我在哪里可以了解它失败的原因,或者你能告诉我我做错了什么吗?
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
echo "rc.local is running..." > /tmp/rc.local-output
touch /var/lock/subsys/local
exec /usr/local/bin/forever start -c /usr/local/bin/node /var/www/node/myapp/app.js &
exec /usr/local/bin/forever start -c /usr/local/bin/node /var/www/node/myapp/tools/push/push_service.js &
好的,情况似乎有所好转,我将我的 rc.local 文件更新为:
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
exec 2> /tmp/rc.local.log # send stderr from rc.local to a log file
exec 1>&2 # send stdout to the same log file
set -x # tell sh to display commands before execution
echo "rc.local is running..." >> /tmp/rc.local-output
touch /var/lock/subsys/local
/usr/local/bin/forever start /var/www/node/myapp/app.js &
/usr/local/bin/forever start /var/www/node/myapp/tools/push/push_service.js &
而 /tmp/rc.local.log 告诉我这个:
/usr/bin/env: 节点:没有这样的文件或目录
【问题讨论】:
-
我根据这个问题/答案为节点添加了一个符号链接,现在看起来一切正常:D stackoverflow.com/questions/20061529/…