I have a node.js server that I'd like to make a service so it wouldn't shut down after closing SSH-session.
I followed instructions in here, but it didn't go quite as planned because instead of the service starting up it gave me the following error:
Loaded: loaded (/etc/systemd/system/jasentiedot.service; enabled; vendor preset: disabled)
Active: failed (Result: start-limit) since ti 2018-01-23 10:38:08 EET; 59s ago
Process: 10525 ExecStart=/home/nodeuser/jasentiedot/server.js (code=exited, status=203/EXEC)
Main PID: 10525 (code=exited, status=203/EXEC)
Here is the service file at /etc/systemd/system/jasentiedot.service
[Unit]
Description=Servicename
[Service]
ExecStart=/home/nodeuser/jasentiedot/server.js
Restart=always
User=nobody
Group=nobody
Environment=PATH=/usr/bin:/usr/local/bin
Environment=NODE_ENV=production
WorkingDirectory=/home/nodeuser/jasentiedot
[Install]
WantedBy=multi-user.target
The script runs fine when running it manually, so there shouldn't be anything wrong with that.
Is there any better methods to make node.js script persistent in case this doesn't work out? I tried forever, but that didn't work.