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.targetsystemctl daemon-reloadreloads all unit filessystemctl cat app.serviceviews the unit file
systemctl enable app.servicesystemctl disable app.service
systemctl start app.servicesystemctl stop app.servicesystemctl status app.service
journalctl -u app.service -f - -f is the tail argument