Setup node.js application service [deprecated] - Stu-emhTrade/sailmate GitHub Wiki
Install forever as global :
npm install forever -g
Then install forever-service : the key program here!
npm install forever-service -g
This is the github link: https://github.com/zapty/forever-service
Then, you HAVE TO rename your program to app.js. Lets say we want our service to be called canLogService, we run this command in the same directory than app.js:
sudo forever-service install canLogService
If everything went right, you are now able to start|stop|restart your service like this:
sudo service canLogService start
sudo service canLogService stop
sudo service canLogService restart
Run at startup To run the service at the startup, open the file /etc/rc.local :
sudo nano /etc/rc.local
And add to the end (but before exit 0) the following line:
sudo service myService start
sudo is important here!