Instalei Rocket.chat no meu Debian Jessie, ele funciona bem e eu quero iniciá-lo automaticamente na inicialização como um serviço.
Para iniciar o Rocket.chat manualmente eu preciso
$ cd /home/hung/Rocket.chat
$ node main.js
Este é meu /etc/systemd/system/rocket-chat.service
[Service]
ExecStart=/usr/local/bin/node main.js
Restart=always
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=rocket-chat
User=hung
Group=hung
WorkingDirectory=/home/hung/Rocket.chat
[Install]
WantedBy=multi-user.target
O serviço não inicia:
# systemctl start rocket-chat
# systemctl status rocket-chat
● rocket-chat.service
Loaded: loaded (/etc/systemd/system/rocket-chat.service; disabled)
Active: failed (Result: start-limit) since Fri 2018-03-02 22:30:16 +07; 4s ago
Process: 1169 ExecStart=/usr/local/bin/node main.js (code=exited, status=200/CHDIR)
Main PID: 1169 (code=exited, status=200/CHDIR)
Mar 02 22:30:16 debian systemd[1]: rocket-chat.service: main process exited, code=exited, status=200/CHDIR
Mar 02 22:30:16 debian systemd[1]: Unit rocket-chat.service entered failed state.
Mar 02 22:30:16 debian systemd[1]: rocket-chat.service holdoff time over, scheduling restart.
Mar 02 22:30:16 debian systemd[1]: Stopping rocket-chat.service...
Mar 02 22:30:16 debian systemd[1]: Starting rocket-chat.service...
Mar 02 22:30:16 debian systemd[1]: rocket-chat.service start request repeated too quickly, refusing to start.
Mar 02 22:30:16 debian systemd[1]: Failed to start rocket-chat.service.
Mar 02 22:30:16 debian systemd[1]: Unit rocket-chat.service entered failed state.
Aqui está o que está em / var / log / syslog:
# tail /var/log/syslog
Mar 2 22:17:21 debian systemd[1]: Started rocket-chat.service.
Mar 2 22:17:21 debian systemd[1068]: Failed at step CHDIR spawning /usr/local/bin/node: No such file or directory
Mar 2 22:17:22 debian systemd[1]: rocket-chat.service: main process exited, code=exited, status=200/CHDIR
Mar 2 22:17:22 debian systemd[1]: Unit rocket-chat.service entered failed state.
Mar 2 22:17:22 debian systemd[1]: rocket-chat.service holdoff time over, scheduling restart.
Mar 2 22:17:22 debian systemd[1]: Stopping rocket-chat.service...
Mar 2 22:17:22 debian systemd[1]: Starting rocket-chat.service...
Mar 2 22:17:22 debian systemd[1]: rocket-chat.service start request repeated too quickly, refusing to start.
Mar 2 22:17:22 debian systemd[1]: Failed to start rocket-chat.service.
Mar 2 22:17:22 debian systemd[1]: Unit rocket-chat.service entered failed state.
/usr/local/bin/node
existe:
$ /usr/local/bin/node --version
v8.9.3
Como resolvo o problema de que /usr/local/bin/node
não foi encontrado?