run_checking_node_failure.sh 434 B

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