-
-
Save minrwhite/cd33f4755b51a2f4c2f6275e0a299ed4 to your computer and use it in GitHub Desktop.
Revisions
-
minrwhite revised this gist
Mar 12, 2018 . 1 changed file with 16 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,8 @@ #!/usr/bin/env bash set -e declare -A first_start function handle_event() { local entry="$1" local action=$(echo $entry | jq -r '.action') @@ -9,10 +11,23 @@ function handle_event() { if [ -x "$hook" ]; then "$hook" "$entry" fi if [ "$action" == "create" ]; then first_start["$service"]=1 fi if [ "$action" == "start" ] && [ "${first_start[$service]}" -eq "1" ]; then unset first_start["$service"] local subhook="./hooks/$service/first_start" if [ -x "$subhook" ]; then "$subhook" "$entry" fi fi } docker-compose events --json | ( while read line; do handle_event "$line" done ) -
dnephin revised this gist
Jan 8, 2016 . No changes.There are no files selected for viewing
-
dnephin created this gist
Jan 8, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ #!/bin/bash set -e function handle_event() { local entry="$1" local action=$(echo $entry | jq -r '.action') local service=$(echo $entry | jq -r '.service') local hook="./hooks/$service/$action" if [ -x "$hook" ]; then "$hook" "$entry" fi } docker-compose events --json | ( while read line; do handle_event "$line" done )