Introduction
How to run a script or executable file as a service
First, create a service unit by creating this file :
/lib/systemd/system/xxx.service (Most of OS)
Then, enable the service :
chmod 644 xxx.servicesystemctl enable|disable xxx.servicesystemctl start|stop|status xxx.service
If you modified the service file, issue this command to take modifications in account :
systemctl daemon-reload xxx.service
Code
see files here