Linux
systemd Unit Generator
Generate a systemd unit file for your service: command, dedicated user, restart policy and installation commands.
How it works
A systemd unit describes how to start, stop and supervise a service. The file goes in /etc/systemd/system/my-app.service.
Best practices: run under a dedicated non-privileged user, set Restart=on-failure, avoid secrets in Environment (use EnvironmentFile with a file in 600), and enable the service with systemctl enable --now.
Examples
Python API
Complete unit ready to install.
| name | nettools-api |
| description | API NetTools |
| exec_start | /opt/nettools/.venv/bin/uvicorn app.main:app --host 127.0.0.1 --port 8000 |
| user | nettools |
| restart | on-failure |
| working_dir | /opt/nettools |
| environment | |
| wanted_by | multi-user.target |
Frequently asked questions
Where should the unit file go?
/etc/systemd/system/name.service, then systemctl daemon-reload and systemctl enable --now name.
How do you check the logs?
journalctl -u name -f, or --since '10 min ago' for recent history.
Is Restart=always a good idea?
For a critical service, yes, but it masks repeated crashes: combine it with restart monitoring (StartLimitBurst).