runnerproc

package
v1.7.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package runnerproc 判定某个安装目录下的 actions/runner 进程是否存活。

为什么不读 pid 文件:actions/runner 根本不写。三个启动脚本 (src/Misc/layoutroot/run.sh、src/Misc/layoutroot/run-helper.sh.template、 src/Misc/layoutbin/runsvc.sh)里都没有落 pid 文件的语句,pid 只存在 shell 变量 $PID 里;安装目录下的 .path 装的是 PATH 字符串,不是 pid——runsvc.sh 里就写着 `export PATH=$(cat .path)`。

早先按 "Runner.Listener.pid" / ".path" 读 pid 的做法因此对任何一个真实的 runner 目录都恒为「未找到」,于是每个 runner 都被判定为未运行,被 Manager 的定时巡检每 5 分钟重复拉起一次。

改为扫 procfs、按 argv 里的绝对路径认领进程。扫描本身由 procfind-kit 负责, 本包只留 actions/runner 特有的那部分知识:哪些脚本、哪个可执行文件, 以及为什么两者都得认(见 runnerSpec)。

只在有 procfs 的系统(Linux)上有效;其余平台一律返回「找不到」, 与修复前的实际行为一致(那时 pid 文件同样永远不存在)。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Find

func Find(installDir string) []int

Find 返回属于 installDir 的 runner 进程 pid,监护脚本在前、监听器在后。

func FindMany

func FindMany(installDirs []string) map[string][]int

FindMany 一次扫描 procfs,把进程分派给各自的安装目录,结果按传入的原字符串索引。 与逐个调用 Find 等价,区别只在于 N 个目录也只扫一遍——List 要同时判定一整批 runner,逐个扫等于把整张进程表读 N 遍。

func ListenerBinary

func ListenerBinary(installDir string) string

ListenerBinary 返回该安装目录下 Runner.Listener 可执行文件的绝对路径。

func Running

func Running(installDir string) bool

Running 报告 installDir 下是否有 runner 进程存活

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL