[Unit]
Description=<description about this service>
[Service]
User=<user e.g. root>
WorkingDirectory=<directory_of_script e.g. /root>
ExecStart=<script which needs to be executed>
Restart=always
[Install]
WantedBy=multi-user.target
# Check if the service is running
systemctl status SERVICE_NAME.service
# Stop service
systemctl stop SERVICE_NAME.service
# Check if autostart is enabled
systemctl is-enabled SERVICE_NAME.service
# Disable autostart
systemctl disable SERVICE_NAME.service