Skip to main content

此版本的 GitHub Enterprise 已停止服务 2022-10-12. 即使针对重大安全问题,也不会发布补丁。 为了获得更好的性能、更高的安全性和新功能,请升级到最新版本的 GitHub Enterprise。 如需升级帮助,请联系 GitHub Enterprise 支持

Configuring the self-hosted runner application as a service

You can configure the self-hosted runner application as a service to automatically start the runner application when the machine starts.

注意:GitHub Enterprise Server 目前不支持 GitHub 托管的运行器。 可以在 GitHub public roadmap 上查看有关未来支持计划的更多信息。

Note: You must add a runner to GitHub Enterprise Server 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.

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

Starting the service

Start the service with the following command:

sudo ./svc.sh start

Checking the status of the service

Check the status of the service with the following command:

sudo ./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

Uninstalling the service

  1. Stop the service if it is currently running.

  2. Uninstall the service with the following command:

    sudo ./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.