How to launch let'schat (nodejs app) as deamon?

Antoine asked:

I have installed “let’s chat” on my server. In the documentation, they say to launch the application with

npm start

from the directory where the application is installed.

But i’m unable to launch it with systemd. I want the application to be always online. So it works if I manually launch

cd /MIDDLE/uow/lets-chat/ && /bin/npm start

but not if I configure the line in Execstart from systemd. I try with the same line, I try with npm, I try with “node ./apps.js” :

ExecStart=/usr/bin/cd /MIDDLE/uow/lets-chat/ && /usr/local/bin/node /MIDDLE/uow/lets-chat/app.js 

(I try with or without absolute path for my command but it change nothing).

I don’t know how to launch this application as deamon in my centos. How can I do please ?

Thank you,


My answer:

You need to set both ExecStart= and WorkingDirectory= to the appropriate values. For example:

ExecStart=/usr/local/bin/node /MIDDLE/uow/lets-chat/app.js

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.