#!/bin/bash
# Allo-GG
# Demarrage du module apres les services :

while ! apache2 -v | head -n 1 | grep -q 'Server version: Apache/[0-9]'; do
	sleep 5
done

while ! gpio -v | head -n 1 | grep -q 'gpio version: [0-9]'; do
	sleep 5
done

while ! /sbin/ifconfig wlan0 | grep -q 'inet [0-9]'; do
	sleep 5
done

# Declarations des GPIO :

# PIN 7 (Porte)
sleep 1
gpio -g write 4 1
sleep 1
gpio -g mode 4 out

# PIN 11 (Sonette)
sleep 1
gpio -g write 17 1
sleep 1
gpio -g mode 17 out

# PIN 12 (LED VERTE D'ETAT)
sleep 1
gpio -g write 18 1
sleep 1
gpio -g mode 18 out
sleep 1
gpio -g write 18 0
sleep 1

# Lancement de la premiere verification des services :

/bin/bash /var/www/html/scripts/check_services.sh &
exit
