File location

  • /etc/systemd/system/

Simple Unit Example

Base service

Let file name be: my-script.service

[Unit]
Description=My Script
After=network.target

[Service]
ExecStart=/path/to/your/script.sh
Restart=always
User=username
Group=groupname

[Install]
WantedBy=multi-user.target

Then run

sudo systemctl daemon-reload
 
sudo systemctl enable --now my-script
 
sudo systemctl status my-script

Simple Timer associated to service

Let file name be: my-script.timer