Last active
April 14, 2018 03:53
-
-
Save omartrigui/db0572f18a3e30c5e0bbe047e0bade82 to your computer and use it in GitHub Desktop.
Daemonize nodejs service using systemd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# vim /etc/systemd/system/myservice.service | |
[Unit] | |
Description=myservice-description | |
After=network.target | |
[Service] | |
ExecStart=/opt/myservice-location/src/node/server.js | |
Restart=always | |
User=me | |
Group=group | |
Environment=PATH=/usr/bin:/usr/local/bin | |
Environment=NODE_ENV=production | |
WorkingDirectory=/opt/myservice-location | |
[Install] | |
WantedBy=multi-user.target | |
# systemctl start myservice | |
# https://nodesource.com/blog/running-your-node-js-app-with-systemd-part-1/ | |
# https://www.axllent.org/docs/view/nodejs-service-with-systemd/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment