以下是简介中所述的问题解决细节,记录之以便日后查阅。
运行一个node.js示例程序:
# forever start app.js
发现出来下面的错误:
warn: --minUptime not set. Defaulting to: 1000ms warn: --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms info: Forever processing file: . error: Cannot start forever error: log file /root/.forever/forever.log exists. Use the -a or --append option to append log.
一大串英文懒得看,直接看看forever有没有运行什么程序:
# forever list
果然发现没有运行任何程序:
info: No forever processes running
细看了一下提示,像是这个文件存在“/root/.forever/forever.log”,于是删除之:
# rm - f /root/.forever/forever.log
再来运行示例程序(切换到程序目录可以用“.”作为目标参数):
# forever start .
结果终于成功了:
warn: --minUptime not set. Defaulting to: 1000ms warn: --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms info: Forever processing file: .
再看看forever运行什么:
# forever list
显示出来已经运行的程序:
info: Forever processes running data: uid command script forever pid id logfile uptime data: [0] ZYKu /usr/bin/node /var/nodetest 18694 18696 /root/.forever/ZYKu.log STOPPED
事情总算解决!