Last active
March 16, 2020 01:54
-
-
Save Allakazan/99a70ebda585d3c94a8230c9fe332d2f to your computer and use it in GitHub Desktop.
Node Js service on Systemd
This file contains 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
# this file need to be on /etc/systemd/system/ | |
[Unit] | |
Description=Your Node Service | |
After=network.target | |
[Service] | |
User=root | |
WorkingDirectory=/path/to/your/node-project | |
ExecStart=/usr/bin/node /path/to/your/node-project/index.js | |
Environment=PATH=/bin:/usr/bin:/usr/local/bin | |
Environment=NODE_ENV=production | |
RestartSec=3 # Seconds to wait before restart | |
Restart=always # can be: Restart=on-failure | |
[Install] | |
WantedBy=multi-user.target | |
~ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment