Systemd manages these services in
unit files like this.
Description=Some Really Important Service
The program that will start is.
while true; do
echo 'service is working'
If you don’t want to use this line
#!/usr/bin/env bash, then you should make sure to specify what is the program is dedicated to execute the script like this.
If you want to execute this service, you should store it in
/etc/systemd/system/. You can copy the unit file to that directory, or symlink it.
Now you can
disable the service.
systemctl start sample
|start the service or run it
systemctl stop sample
|stop the service
systemctl enable sample
|make the service start automatically on the system boot
systemctl disable sample
|the serice will not start when the system boot
To see what the services output, run this command.
If we want to know the current status of the service, use this command.
systemctl status sample
If you want to list all services on your system, run this command.
Want to know more information about services and their units, read more here .