浏览代码

added live server script

Shahed Nasser 1 年之前
父节点
当前提交
e5642e2c69
共有 1 个文件被更改,包括 29 次插入0 次删除
  1. 29 0
      .github/scripts/wait-for-server-live.sh

+ 29 - 0
.github/scripts/wait-for-server-live.sh

@@ -0,0 +1,29 @@
+#!/bin/bash
+
+for i in {1..6}
+do
+  echo $i
+  status_code=$(curl \
+    -X GET \
+    --write-out %{http_code} \
+    --silent\
+    --output /dev/null\
+    http://localhost:9000/store/products)
+
+echo $status_code
+  if [[ "$status_code" -ne 000 ]] ; then
+    echo "exiting"
+    exit 0
+  else
+    sleep 5
+  fi
+done
+
+echo $status_code
+
+if [[ "$status_code" =  000 ]] ; then
+  echo "Site status changed to $status_code"
+  exit 1
+else
+  exit 0
+fi