Interview Prep/Linux/Processes, Signals & systemd

Write a minimal production-quality systemd service unit.

IntermediateConceptProcesses, Signals & systemd
Answer
# /etc/systemd/system/api.service
[Unit]
Description=Orders API
After=network-online.target
Wants=network-online.target

[Service]
User=api
Group=api
WorkingDirectory=/opt/api
EnvironmentFile=/etc/api/api.env
ExecStart=/opt/api/bin/api --port 8080
Restart=on-failure
RestartSec=5
LimitNOFILE=65536

[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload && sudo systemctl enable --now api
All Linux questions Roadmap: Linux

More on Processes, Signals & systemd