0
Good afternoon to all,
I have a JS application that needs to be started on Linux boot, how could I start this application? I tried with systemd, but it didn’t work. Could you give me some link or tip? Any error in the file below?
service manager.
[Unit]
Description=Gerente
After=syslog.target
[Service]
ExecStart=/home/eu/projetos/node/socket5/npm start
RuntimeDirectory=socket5
Restart=always
KillSignal=SIGQUIT
Type=notify
StandardError=syslog
NotifyAccess=all
[Install]
WantedBy=multi-user.target
[Unit]
Description=Gerente
After=syslog.target
Execution:
root@raspberry:/etc/systemd/system# systemctl start gerente.service
Job for gerente.service failed because the control process exited with error code.
See "systemctl status gerente.service" and "journalctl -xe" for details.
root@raspberry:/etc/systemd/system# systemctl status gerente.service
● gerente.service - Gerente
Loaded: loaded (/etc/systemd/system/gerente.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2019-02-07 16:48:20 -02; 27s ago
Process: 1397 ExecStart=/home/harley/projetos/node/socket5/npm start (code=exited, status=203/EXEC)
Main PID: 1397 (code=exited, status=203/EXEC)
fev 07 16:48:19 raspberry systemd[1]: gerente.service: Unit entered failed state.
fev 07 16:48:19 raspberry systemd[1]: gerente.service: Failed with result 'exit-code'.
fev 07 16:48:20 raspberry systemd[1]: gerente.service: Service hold-off time over, scheduling restart.
fev 07 16:48:20 raspberry systemd[1]: Stopped Gerente.
fev 07 16:48:20 raspberry systemd[1]: gerente.service: Start request repeated too quickly.
fev 07 16:48:20 raspberry systemd[1]: Failed to start Gerente.
fev 07 16:48:20 raspberry systemd[1]: gerente.service: Unit entered failed state.
fev 07 16:48:20 raspberry systemd[1]: gerente.service: Failed with result 'exit-code'.
Use the PM2
– Valdeir Psr
I will analyze PM2, thanks @Valdeirpsr.
– Developer
I found the solution good, but when restarting Raspberry, the application does not start automatically. You can configure PM2 to start processes on boot.
– Developer
I checked that there is how, I am analyzing...
– Developer
@Valdeirpsr got it. Excellent solution, meets perfectly. Can you reply so I mark your answer as solution? Thank you very much.
– Developer