瀏覽代碼

fix(scheduler): add wait-for script for docker purposes

Karol Sójko 2 年之前
父節點
當前提交
23ced9427f
共有 1 個文件被更改,包括 17 次插入0 次删除
  1. 17 0
      packages/scheduler/wait-for.sh

+ 17 - 0
packages/scheduler/wait-for.sh

@@ -0,0 +1,17 @@
+#!/bin/sh
+
+set -e
+
+host="$1"
+shift
+port="$1"
+shift
+cmd="$@"
+
+while ! nc -vz $host $port; do
+  >&2 echo "$host:$port is unavailable yet - waiting for it to start"
+  sleep 10
+done
+
+>&2 echo "$host:$port is up - executing command"
+exec $cmd