Basic SystemD Service File

Here's the template I use for a basic SystemD service file. It's super boring. Just executes a command on start, and sends it sigterm on stop. If the command fails, it will try to restart every 2 seconds.

[Unit]
Description=A really cool Node app
After=syslog.target
After=network.target

[Service]
RestartSec=2s
Type=simple
User=nodeweb
Group=nodeweb
WorkingDirectory=/var/lib/app/nodeweb/
ExecStart=/usr/bin/env node /var/lib/app/nodeweb/index.js
Restart=always
Environment=USER=nodeweb HOME=/var/lib/app/nodeweb/

[Install]
WantedBy=multi-user.target