← Files

systemd Service Unit

Run an app as a service with restart on failure.

[Unit]
Description=[App name]
After=network.target

[Service]
Type=simple
User=app
WorkingDirectory=/srv/app
ExecStart=/usr/bin/node server.js
Restart=on-failure
RestartSec=5
Environment=NODE_ENV=production

[Install]
WantedBy=multi-user.target