Adapted/shortened from digitalocean
nano /etc/systemd/system/app.service
[Unit]
Description=App
After=multi-user.target
Wants=network-online.target # all these lines are optional
After=network-online.target
[Service]
WorkingDirectory=/home/user/...
User=user
Group=user
ExecStart=/usr/bin/... #full command with full paths
Type=idle
Restart=always
RestartSec=15
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
reloads all unit filessystemctl cat app.service
views the unit file
systemctl enable app.service
systemctl disable app.service
systemctl start app.service
systemctl stop app.service
systemctl status app.service
journalctl -u app.service -f
- -f
is the tail argument