Skip to main content

Enterprise Server 3.20 ist derzeit als Release Candidate verfügbar.

Selbstgehostete Runner-Anwendung als Dienst konfigurieren

Du kannst die Anwendung für selbstgehostete Runner als Dienst konfigurieren, um die Runneranwendung automatisch zu starten, wenn der Rechner hochfährt.

Platform navigation

Hinweis

GitHub Enterprise Server users should use self-hosted runners. GitHub-hosted runners are not supported.

Hinweis

You must add a runner to GitHub before you can configure the self-hosted runner application as a service. For more information, see Adding self-hosted runners.

For Linux systems that use systemd, you can use the svc.sh script that is created after successfully adding the runner to install and manage using the application as a service.

On the runner machine, open a shell in the directory where you installed the self-hosted runner application. Use the commands below to install and manage the self-hosted runner service.

Hinweis

Configuring the self-hosted runner application as a service on Windows is part of the application configuration process. If you have already configured the self-hosted runner application but did not choose to configure it as a service, you must remove the runner from GitHub and re-configure the application. When you re-configure the application, choose the option to configure the application as a service.

For more information, see Removing self-hosted runners and Adding self-hosted runners.

You can manage the runner service in the Windows Services application, or you can use PowerShell to run the commands below.

Hinweis

You must add a runner to GitHub before you can configure the self-hosted runner application as a service. For more information, see Adding self-hosted runners.

On the runner machine, open a shell in the directory where you installed the self-hosted runner application. Use the commands below to install and manage the self-hosted runner service.

Installing the service

  1. Stop the self-hosted runner application if it is currently running.

  2. Install the service with the following command:

    sudo ./svc.sh install
    
  3. Alternatively, the command takes an optional user argument to install the service as a different user.

    ./svc.sh install USERNAME
    

Installing the service

  1. Stop the self-hosted runner application if it is currently running.

  2. Install the service with the following command:

    ./svc.sh install
    

Starting the service

Start the service with the following command:

sudo ./svc.sh start

Hinweis

On Debian-based Linux systems (such as Debian or Ubuntu) with needrestart enabled, you can prevent needrestart from restarting the runner service during a workflow job by configuring it to ignore the runner service. Run the following command:

echo '$nrconf{override_rc}{qr(^actions\.runner\..+\.service$)} = 0;' | sudo tee /etc/needrestart/conf.d/actions_runner_services.conf
Start-Service "actions.runner.*"
./svc.sh start

Checking the status of the service

Check the status of the service with the following command:

sudo ./svc.sh status
Get-Service "actions.runner.*"
./svc.sh status

For more information on viewing the status of your self-hosted runner, see Monitoring and troubleshooting self-hosted runners.

Stopping the service

Stop the service with the following command:

sudo ./svc.sh stop
Stop-Service "actions.runner.*"
./svc.sh stop

Uninstalling the service

  1. Stop the service if it is currently running.

  2. Uninstall the service with the following command:

    sudo ./svc.sh uninstall
    
    Remove-Service "actions.runner.*"
    
    ./svc.sh uninstall
    

Customizing the self-hosted runner service

If you don't want to use the above default systemd service configuration, you can create a customized service or use whichever service mechanism you prefer. Consider using the serviced template at actions-runner/bin/actions.runner.service.template as a reference. If you use a customized service, the self-hosted runner service must always be invoked using the runsvc.sh entry point.

Customizing the self-hosted runner service

If you don't want to use the above default launchd service configuration, you can create a customized service or use whichever service mechanism you prefer. Consider using the plist template at actions-runner/bin/actions.runner.plist.template as a reference. If you use a customized service, the self-hosted runner service must always be invoked using the runsvc.sh entry point.