All checks were successful
supervise.sh пишет в .pid номер самого демона, журнал без буфера sed, лишних демонов каталога останавливает SIGTERM; register.sh сначала останавливает прежнего демона. Тест с mock-act-runner. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
17 lines
909 B
Bash
Executable File
17 lines
909 B
Bash
Executable File
#!/bin/sh
|
|
# mock-act-runner — stands in for `act_runner` of the gitea/act_runner image (PEP-320 test).
|
|
# The test links it as <tmp>/act_runner so supervise.sh recognises it by its command line, as the real one.
|
|
# register --config … --name <n> … → writes a new .runner in the current directory (unique each time)
|
|
# daemon --config … → runs until SIGTERM (graceful exit, like act_runner), logs to stdout
|
|
case "$1" in
|
|
register)
|
|
printf '{"id":%s,"uuid":"mock-%s-%s","name":"%s"}\n' "$$" "$$" "$(date +%s)" "$*" > .runner
|
|
echo "mock runner registered successfully" ;;
|
|
daemon)
|
|
[ -f .runner ] || { echo "mock: no .runner here" >&2; exit 1; }
|
|
trap 'echo "mock daemon $$ stopping gracefully"; exit 0' TERM
|
|
echo "mock daemon $$ declare successfully"
|
|
while :; do sleep 1 & wait $!; done ;;
|
|
*) echo "mock-act-runner: unknown command $1" >&2; exit 2 ;;
|
|
esac
|