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