Просмотр исходного кода

adding cron job to start node on its failure

HgH 2 лет назад
Родитель
Сommit
e088a5ec00
1 измененных файлов с 12 добавлено и 0 удалено
  1. 12 0
      run_checking_node_failure.sh

+ 12 - 0
run_checking_node_failure.sh

@@ -0,0 +1,12 @@
+#!/bin/bash
+URL="http://127.0.0.1:3000/login"
+response=$(curl -o /dev/null -s -w "%{http_code}\n" $URL)
+http_code=$(tail -n1 <<< "$response")  # get the last line
+content=$(sed '$ d' <<< "$response")   # get all but the last line which contains the status code
+echo "$http_code"
+if [ $http_code != "200" ]; then
+   echo "is not 200"
+   /usr/local/lib/nodejs/node-v20.10.0-linux-x64/bin/node dist/ssr/index.js
+else
+   echo "is 200"
+fi