# This is a simple example for creating a systemd service which runs an executable after system startup and restarts unless stopped. cat > /etc/systemd/system/example.service << EOF [Unit] Description=An example service After=network.target [Service] ExecStart=/home/user/script.sh Restart=always [Install] WantedBy=multi-user.target EOF systemctl enable example.service systemctl start example.service # Use 'journalctl -u example.service' to view the service logs, # or view the status and other information with 'systemctl status example.service'