sudo nano /etc/systemd/system/api-runner.service [Unit] Description=GitHub Self-Hosted Runner After=network.target
[Service]
Change these paths to your runner's installation directory
ExecStart=/home/ubuntu/runners/api/run.sh User=ubuntu WorkingDirectory=/home/ubuntu/runners/api Environment="RUNNER_ALLOW_RUNASROOT=1"
If you want to restart the service automatically in case of failure
Restart=always RestartSec=10
[Install] WantedBy=multi-user.target
sudo systemctl daemon-reload sudo systemctl start api-runner sudo systemctl enable api-runner sudo systemctl status api-runner