- Create some name that you want and add extension ".service" after your service name => simple.service
- sudo nano your name.service
- Add this code to your service
[Unit]
Description=Your Description
After=multi-user.target
[Service]
Type=idle
ExecStart=/Path to run the program/ /Path to run file/
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
- Save and exit
- give a 644 permission to your file service with chmod
- run this two command to operate your service
sudo systemctl daemon-reload
sudo systemctl enable /path of yourservice.service
- reboot the system
- to grab the log, use this command
sudo systemctl status yourservice