Skip to content

Commit 8516d37

Browse files
committed
heredoc fix
1 parent be9d5b8 commit 8516d37

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/ec2_gha/templates/user-script.sh.templ

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -234,27 +234,27 @@ touch $$V-last-activity
234234
EOFC
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
239239
exec >> /tmp/termination-check.log 2>&1
240-
source $$B/runner-common.sh
240+
source /usr/local/bin/runner-common.sh
241241
V="/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
256256
else
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"
258258
fi
259259
EOFT
260260

0 commit comments

Comments
 (0)