ssh连接ubuntu服务器关闭连接程序停止问题

通过xshell连接ubuntu服务器,运行一个express的项目,关闭xshell后,项目不能正常访问。

ubuntu@VM-9-185-ubuntu:/usr/zicai/projects/node01$ npm start
> [email protected] start /usr/zicai/projects/node01
> node ./bin/www

尝试用nohup命令让程序在服务器后台运行

ubuntu@VM-9-185-ubuntu:/usr/zicai/projects/node01$ sudo nohup node ./bin/www /null &>/dev/null &
[1] 11067
ubuntu@VM-9-185-ubuntu:/usr/zicai/projects/node01$

关闭xshell,程序依旧可以运行。注意后面的 /null &>/dev/null &这段需要加上,不然会报

nohup: ignoring input and appending output to 'nohup.out'

 

你可能感兴趣的:(计算机)