File tree Expand file tree Collapse file tree 1 file changed +14
-14
lines changed
Expand file tree Collapse file tree 1 file changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -234,27 +234,27 @@ touch $$V-last-activity
234234EOFC
235235
236236# check-runner-termination.sh is called periodically to check if the instance should terminate
237- cat > $$ B/check-runner-termination.sh << EOFT
237+ cat > $$ B/check-runner-termination.sh << ' EOFT '
238238#!/bin/bash
239239exec >> /tmp/termination-check.log 2>&1
240- source $$ B /runner-common.sh
240+ source /usr/local/bin /runner-common.sh
241241V="/var/run/github-runner"
242- A="\\ $ $ V-last-activity"
243- J="\\ $ $ V-jobs"
244- H="\\ $ $ V-has-run-job"
245- [ ! -f "\\ $$ A" ] && touch "\\ $ $ A"
246- L=\\ $$ (stat -c %Y "\\ $ $ A" 2>/dev/null || echo 0)
247- N=\\ $ $ (date +%s)
248- I=\\ $ $ ((N-L))
249- [ -f "\\ $$ H" ] && G=\\ $$ {RUNNER_GRACE_PERIOD:-60} || G=\\ $ $ {RUNNER_INITIAL_GRACE_PERIOD:-180}
250- R=\\ $$ (grep -l '\ "status\":\ "running\ "' \\ $ $ J/*.job 2>/dev/null | wc -l || echo 0)
251- if [ \\ $$ R -eq 0 ] && [ \\ $$ I -gt \\ $ $ G ]; then
252- log "TERMINATING: idle \\ $$ I > grace \\ $ $ G"
242+ A="$V-last-activity"
243+ J="$V-jobs"
244+ H="$V-has-run-job"
245+ [ ! -f "$ A" ] && touch "$A"
246+ L=$ (stat -c %Y "$A" 2>/dev/null || echo 0)
247+ N=$(date +%s)
248+ I=$((N-L))
249+ [ -f "$ H" ] && G=$ {RUNNER_GRACE_PERIOD:-60} || G=${RUNNER_INITIAL_GRACE_PERIOD:-180}
250+ R=$ (grep -l '"status": "running"' $J/*.job 2>/dev/null | wc -l || echo 0)
251+ if [ $ R -eq 0 ] && [ $ I -gt $G ]; then
252+ log "TERMINATING: idle $ I > grace $G"
253253 deregister_all_runners
254254 flush_cloudwatch_logs
255255 debug_sleep_and_shutdown
256256else
257- [ \\ $$ R -gt 0 ] && log "\\ $$ R job(s) running" || log "Idle \\ $$ I/ \\ $ $ G sec"
257+ [ $ R -gt 0 ] && log "$ R job(s) running" || log "Idle $I/ $G sec"
258258fi
259259EOFT
260260
You can’t perform that action at this time.
0 commit comments