Simplest way I found is too install the node.js application named "forever"
Just install forever in your server like:
sudo npm install -g forever
Then you can run your application as service like (inside your actual node application):
forever start bot.js
To kill the service:
Show the forver process list:
forver list
Will return something like this:
info: Forever processes running
data: uid command script forever pid id logfile uptime
data: [0] 1RSg /root/.nvm/versions/node/v9.5.0/bin/node bot.js 20554 20560 /root/.forever/1RSg.log 0:0:10:44.34400000000005
Then get the forever id which is from the sample above is [0] and stop the process like this:
forever stop 0
Add new comment