我在我的服务器上安装了“让我们聊天”。 在文档中,他们说要启动应用程序
npm start
从应用程序的安装目录中。
但是我无法用systemd启动它。 我希望应用程序始终在线。 所以它工作,如果我手动启动
cd /MIDDLE/uow/lets-chat/ && /bin/npm start
但是如果我从systemdconfigurationExecstart中的行,则不行。 我尝试使用相同的行,我试着用npm,我试着用“node ./apps.js”:
ExecStart=/usr/bin/cd /MIDDLE/uow/lets-chat/ && /usr/local/bin/node /MIDDLE/uow/lets-chat/app.js
(我尝试用或不用绝对path来执行我的命令,但是它没有任何改变)。
我不知道如何在我的centos中像deamon一样启动这个应用程序。 我该怎么办?
谢谢,
一个。
您需要将ExecStart=和WorkingDirectory=设置为适当的值。 例如:
WorkingDirectory=/MIDDLE/uow/lets-chat ExecStart=/usr/local/bin/node /MIDDLE/uow/lets-chat/app.js