Skip to content

Instantly share code, notes, and snippets.

@ffflorian
Created September 1, 2016 16:22
Show Gist options
  • Save ffflorian/a67605537a20b701a9d9f62f7d031da0 to your computer and use it in GitHub Desktop.
Save ffflorian/a67605537a20b701a9d9f62f7d031da0 to your computer and use it in GitHub Desktop.
Example systemd service for a node.js app
# Create at /etc/systemd/system/ or ~/.config/systemd/user/
# Enable with systemctl enable appname.service
# Start with systemctl start appname.service
[Unit]
Description=Appname
# wait for network
After=network.target
[Service]
User=node
ExecStart=/usr/bin/node /opt/node/appname/index.js
Restart=on-failure
RestartSec=10
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=appname-node
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment