Skip to content

Instantly share code, notes, and snippets.

@Allakazan
Last active March 16, 2020 01:54
Show Gist options
  • Save Allakazan/99a70ebda585d3c94a8230c9fe332d2f to your computer and use it in GitHub Desktop.
Save Allakazan/99a70ebda585d3c94a8230c9fe332d2f to your computer and use it in GitHub Desktop.
Node Js service on Systemd
# 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