#! /bin/bash
while true; do
curl -I https://www.wikipedia.org
if [ $? -ne 0 ]; then
python /home/user1/Desktop/LEDj2on.py
echo "$(date)" >> "/home/user1/curl_failures.log"
else
python /home/user1/Desktop/LEDj2off.py
fi

if [ -s /home/user1/curl_failures.log ]; then
python /home/user1/Desktop/LEDr2on.py
else 
python /home/user1/Desktop/LEDr2off.py
fi

if [ -s /home/user1/curl_failures.log ]; then
python /home/user1/Desktop/LEDv2off.py
else 
python /home/user1/Desktop/LEDv2on.py
fi

sleep 1
done
