Systemd Unit Generator

Generate systemd service, timer, mount, path & socket units

General

Dependencies

Execution

Environment

No environment variables

Resources

Resource limits are off

Hardening

my-app.service· 22 lines
[Unit]
Description=My App Service
After=network.target

[Service]
Type=simple
User=www-data
Group=www-data
WorkingDirectory=/var/www/my-app
ExecStart=/usr/bin/python3 /var/www/my-app/main.py
Restart=on-failure
RestartSec=5
StandardOutput=journal
StandardError=journal
NoNewPrivileges=yes
PrivateTmp=yes
ProtectSystem=strict
ProtectHome=yes

[Install]
WantedBy=multi-user.target

Save to /etc/systemd/system/my-app.service then:

sudo systemctl daemon-reload
sudo systemctl enable --now my-app.service
sudo systemctl status my-app.service
journalctl -u my-app.service -f