Create the service unit
sudo touch /lib/systemd/system/sample.service
sudo chmod 664 /lib/systemd/system/sample.service
Reload the systemd
sudo systemctl daemon-reload
Check the unit is present
sudo systemctl list-unit-files | grep sample
Start the service
sudo systemctl start sample.service
Stop the service
sudo systemctl stop sample.service
Check the status
sudo systemctl status sample.service
Check the status with no logs truncaton
sudo systemctl -l status sample.service
Restart the service
sudo systemctl restart sample.service
Enable auto start the service on boot
sudo systemctl enable sample.service
Check logs
sudo journalctl -u sample.service
Follow logs like tail -f
sudo journalctl -f -u sample.service