Skip to content

Instantly share code, notes, and snippets.

@e0da
Created February 20, 2020 21:33
Show Gist options
  • Save e0da/25b69756c0414d5f5ecbfbbfa9c078ca to your computer and use it in GitHub Desktop.
Save e0da/25b69756c0414d5f5ecbfbbfa9c078ca to your computer and use it in GitHub Desktop.
terminator=$(mktemp --dry-run /tmp/terminator.XXX)
echo "touch $terminator to stop"
(
while true; do
if [[ -f "$terminator" ]]; then
kill "$CHILD_PID"
echo "Killed $CHILD_PID because the main container terminatord."
exit
fi
sleep 1
done
) &
trap "touch $terminator" EXIT
"$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment