Skip to content

Linux

systemd Service File Generator

Exec command, restart policy, user, and env vars - a complete .service file plus install steps.

Environment variables (optional)

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

[Service]
Type=simple
ExecStart=/usr/bin/node /path/to/app.js
Restart=on-failure

[Install]
WantedBy=multi-user.target

Install

  1. sudo cp my-app.service /etc/systemd/system/my-app.service
  2. sudo systemctl daemon-reload
  3. sudo systemctl enable my-app.service
  4. sudo systemctl start my-app.service
  5. sudo systemctl status my-app.service