الملفات
ghaymah-exam-abdelaziz-sre/q1-deploy-monitor/health-check.sh

17 أسطر
282 B
Bash
ملف تنفيذي

#!/bin/bash
URL="http://localhost:8000/health"
while true
do
response=$(curl -s -o /dev/null -w "%{http_code}" $URL)
if [ "$response" -eq 200 ]; then
echo "$(date): Application is UP"
else
echo "$(date): Application is DOWN"
fi
sleep 30
done