How do you make a systemd service start on boot and restart on failure?

IntermediateConceptLinux and shell
Answer

Set Restart=on-failure (with RestartSec=5) in [Service] and WantedBy=multi-user.target in [Install], then run:

sudo systemctl daemon-reload && sudo systemctl enable --now myapp
All Real-World Interview questions Roadmap: Interview readiness

More on Linux and shell