diff --git a/cx-conndev b/cx-conndev index 2383dde..d5b2118 100755 --- a/cx-conndev +++ b/cx-conndev @@ -44,10 +44,15 @@ fi ### -setx cid=docker-compose ps -q "$service" 2>/dev/null || die "$service: service introuvable" +function die_not_found() { die "$service: service introuvable"; } +setx cid=docker-compose ps -q "$service" 2>/dev/null || die_not_found +[ -n "$cid" ] || die_not_found +edebug "$service id: $cid" -setx ip=docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "$cid" -edebug "$service: $ip" +function die_not_found() { die "$service: $cid: ip introuvable"; } +setx ip=docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "$cid" || die_not_found +[ -n "$ip" ] || die_not_found +edebug "$service ip: $ip" mysqlcmd="$(php bin/conndev.php "$ip" "$@")" edebug "mysqlcmd: $mysqlcmd"