如何启动一个在ssh会话结束时不会结束的进程? [英] How to start a process that won't end when my ssh session ends?

查看:332
本文介绍了如何启动一个在ssh会话结束时不会结束的进程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以某种方式,谷歌搜索无法产生这种结果.

Somehow this isn't yielded by a google search.

我正在用node.js编写服务器脚本.我通过使用节点程序执行其脚本来启动服务器:

I'm scripting a server in node.js. I start the server by executing its script with the node program:

节点myserver.js

node myserver.js

但是服务器保持运行取决于我的ssh会话.我如何使它(以及所有此类过程)持久化? Init.d?

But the server staying up is dependent on my ssh session. How can I make this (and all such processes) persistent? Init.d?

推荐答案

使用nohup命令:

来自 http://en.wikipedia.org/wiki/Nohup

nohup是一个POSIX命令,可忽略HUP(挂断)信号,从而使发出命令的用户注销后该命令可以继续运行.按照惯例,HUP(挂断)信号是终端根据注销过程发出警告的方式.

nohup is a POSIX command to ignore the HUP (hangup) signal, enabling the command to keep running after the user who issues the command has logged out. The HUP (hangup) signal is by convention the way a terminal warns depending processes of logout.

尝试一下:

nohup node myserver.js &

这篇关于如何启动一个在ssh会话结束时不会结束的进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆