notes/ubuntu/systemd.md

477 B

save in //etc/systemd/system/this_file.service

[Unit]
Description=Redis persistent key-value database
After=network.target

[Service]
ExecStart=/usr/bin/node //var/wwww/forecast_api/index.js
User=fc
Restart=always
StandardOutput=syslog
StandardError=syslog
WorkingDirectory=//var/www/forecast_api

[Install]
WantedBy=multi-user.target

sudo systemctl daemon-reload

sudo systemctl enable forecast_api

https://www.axllent.org/docs/view/nodejs-service-with-systemd/