I connect to the linux server via putty SSH. I tried to run it as a background process like this:
$ node server.js &
However, after 2.5
You really should try to use screen
. It is a bit more complicated than just doing nohup long_running &
, but understanding screen once you never come back again.
Start your screen session at first:
user@host:~$ screen
Run anything you want:
wget http://mirror.yandex.ru/centos/4.6/isos/i386/CentOS-4.6-i386-binDVD.iso
Press ctrl+A and then d. Done. Your session keeps going on in background.
You can list all sessions by screen -ls
, and attach to some by screen -r 20673.pts-0.srv
command, where 0673.pts-0.srv is an entry list.
Nohup and screen offer great light solutions to running Node.js in the background. Node.js process manager (PM2) is a handy tool for deployment. Install it with npm globally on your system:
npm install pm2 -g
to run a Node.js app as a daemon:
pm2 start app.js
You can optionally link it to Keymetrics.io a monitoring SAAS made by Unitech.