-
Create EXAMPLE.service in /etc/systemd/system/
-
Modify service script as necessary
ExecStart
is the command to run on startupExecStop
is the command to run on shutdownRestart=always
tells systemd to try to restart the script after 30 seconds if it exits for any reason
- Tell systemd to start this service automatically when the machine starts:
sudo systemctl enable EXAMPLE.service
- Start the service right now (optional):
sudo systemctl start EXAMPLE.service
- Check the status (optional):
sudo systemctl status EXAMPLE.service