Systemd manages these services in unit files like this. [Unit] Description=Some Really Important Service [Service] Type=simple WorkingDirectory=/root ExecStart=/root/my_program.sh [Install] WantedBy=multi-user.target The program that will start is. #!/usr/bin/env bash while true; do echo 'service is working' sleep 3 done 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. ExecStart=/bin/bash /root/my_program.sh 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 start or stop or enable or disable the service.
Posts with the tag systemd: