meta data for this page
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
git:gitlab:runner:shell [2022/01/05 18:07] – niziak | git:gitlab:runner:shell [2022/01/24 13:25] (current) – niziak | ||
---|---|---|---|
Line 32: | Line 32: | ||
</ | </ | ||
+ | <file bash tools/ | ||
+ | #!/bin/bash | ||
+ | #_term() { | ||
+ | # echo "$0 caught SIGTERM signal!" | ||
+ | # trap - SIGTERM | ||
+ | # kill -TERM $child $$ | ||
+ | #} | ||
+ | |||
+ | launch_job() { | ||
+ | PARENT=$1 | ||
+ | shift | ||
+ | " | ||
+ | CHILD=$! | ||
+ | trap "trap - SIGTERM; kill -TERM $CHILD $$" SIGTERM | ||
+ | |||
+ | while sleep 1; do | ||
+ | if [ ! -e / | ||
+ | echo " | ||
+ | kill -TERM $CHILD | ||
+ | exit | ||
+ | fi | ||
+ | |||
+ | if [ ! -e / | ||
+ | wait $CHILD | ||
+ | trap - SIGTERM | ||
+ | exit $? | ||
+ | fi | ||
+ | done | ||
+ | } | ||
+ | |||
+ | #trap _term SIGTERM | ||
+ | #launch_job $$ " | ||
+ | #echo "$0 Waiting for $! to finish" | ||
+ | #wait $! | ||
+ | |||
+ | launch_job $PPID " | ||
+ | </ |