跳到主要内容
CNode

nodejs 断开SSH 服务就退出了 怎么让它一直运行啊?

社区
Gguotingchaopr发布于 13 年前最后回复 13 年前
12114190
查看回复

回复 (12)

B
beiyio#1213 年前

后台运行

G
guotingchaopr#1113 年前
引用 hexienode.js forever模块

@wannianchuan 我再尝试下

W
wannianchuan#913 年前
引用 hexienode.js forever模块

@guotingchaopr 你看看是不是命令的事啊,我用forever start,启动之后程序就能一直运行。 命令如下:forever start app.js

L
leapon#813 年前

在 ubuntu 上,用 upstart 很方便。

我的 upstart 的例子

fetch.conf is a config file for upstart

sudo cp fetch.conf /etc/init/fetch.conf

sudo start fetch sudo stop fetch

fetch.conf 内容:

#!upstart
description "Fetch server"

start on started mountall
stop on shutdown

# Automatically Respawn:
respawn 
respawn limit 99 5

exec node /home/user/server.js -app=fetch >> /var/log/fetch.log 2>&1

http://caolanmcmahon.com/posts/deploying_node_js_with_upstart/

P
Pana#713 年前

学习了

G
guotingchaopr#613 年前
引用 hexienode.js forever模块

我的0.10 .7 nodejs版本使用forever 不知道为什么运行不来

G
guotingchaopr#513 年前
引用 bigfang感觉LZ需要的是这个 或者

@bigfang 谢谢 我弄明白了

G
guotingchaopr#413 年前
引用 bigfang感觉LZ需要的是这个 或者

这个只能Kill掉么?

S
seasonx4#313 年前

nohup node xxx.js > /tmp/log.txt 2>&1 &

B
bigfang#213 年前

感觉LZ需要的是这个

(node app &)

或者

nohup node app &
H
hexie#113 年前

node.js forever模块

参与回复

登录后即可参与回复。登录