소스 검색

mise en forme du script de verif des services

master
heuzef 5 년 전
부모
커밋
a9443b0639
1개의 변경된 파일15개의 추가작업 그리고 17개의 파일을 삭제
  1. +15
    -17
      scripts/check_services.sh

+ 15
- 17
scripts/check_services.sh 파일 보기

@@ -2,8 +2,7 @@
# Allo-GG
# Routine de verification de l'etat des services

echo -e "\e[42m[********************]\e[49m"
echo
echo "********************"
date
echo

@@ -12,9 +11,9 @@ gpio -g write 18 1
# LOG2RAM
if mount | grep -q 'log2ram on /var/log type tmpfs'
then
echo -e "\e[32m\e[32m[OK]\e[39m\e[39m Log2Ram"
echo "[✅ OK] Log2Ram"
else
echo -e "\e[31m\e[31m[ERROR]\e[39m\e[39m Log2Ram"
echo "[❌ ERROR] Log2Ram"
gpio -g write 18 1
exit
fi
@@ -22,9 +21,9 @@ fi
# APACHE
if service apache2 status | grep -q 'running'
then
echo -e "\e[32m[OK]\e[39m Apache"
echo "[✅ OK] Apache"
else
echo -e "\e[31m[ERROR]\e[39m Apache"
echo "[❌ ERROR] Apache"
gpio -g write 18 1
exit
fi
@@ -32,9 +31,9 @@ fi
# CRON
if service cron status | grep -q 'running'
then
echo -e "\e[32m[OK]\e[39m Cron"
echo "[✅ OK] Cron"
else
echo -e "\e[31m[ERROR]\e[39m Cron"
echo "[❌ ERROR] Cron"
gpio -g write 18 1
exit
fi
@@ -43,9 +42,9 @@ fi
# WIRINGPI
if gpio -v | head -n 1 | grep -q 'gpio version: [0-9]'
then
echo -e "\e[32m[OK]\e[39m WiringPi"
echo "[✅ OK] WiringPi"
else
echo -e "\e[31m[ERROR]\e[39m WiringPi"
echo "[❌ ERROR] WiringPi"
gpio -g write 18 1
exit
fi
@@ -57,13 +56,13 @@ fi
if ping -c5 8.8.8.8 | grep -q '0% packet loss'
# Si la reponse est 0 paquets perdu, alors OK
then
echo -e "\e[32m[OK]\e[39m Internet"
echo "[✅ OK] Internet"
# Mais sinon, il y a un probleme
else
# Tentative de relancer le wifi ...
sleep 2
echo
echo -e "\e[93m Probleme sur le Wifi ? Tentative de relancer la connexion en cours ...\e[39m"
echo "[❌ ERROR] Probleme sur le Wifi ? Tentative de relancer la connexion en cours ..."
ifdown --force wlan0
sleep 2
ifup wlan0
@@ -73,10 +72,10 @@ else
if ping -c10 8.8.8.8 | grep -q '0% packet loss'
# Si la reponse est 0 paquets perdu, alors finalement tout va bien
then
echo -e "\e[32m[OK]\e[39m Internet"
echo "[✅ OK] Internet"
# Mais si le probleme est toujours present, alors on alerte :
else
echo -e "\e[31m[ERROR]\e[39m Internet"
echo "[❌ ERROR] Internet"
gpio -g write 18 1
exit
fi
@@ -85,8 +84,7 @@ fi
# Tout va bien ^_^ Allumage de la LED d'etat.
gpio -g write 18 0
echo
echo -e "\e[42m[Tout va bien ^_^]\e[49m"
echo
echo -e "\e[42m[********************]\e[49m"
echo "[✅ OK] Tout va bien 👌"
echo "********************"
echo
exit

불러오는 중...
취소
저장