Projet

Général

Profil

Enzo Di Sotto » script-ping.sh

Enzo Di Sotto, 20/11/2023 18:44

 
#! /bin/bash
while true; do
ping -c 1 131.252.210.176
if [ $? -ne 0 ]; then
python /home/user1/Desktop/LEDj1on.py
echo "$(date)" >> /home/user1/ping_failures.log
else
python /home/user1/Desktop/LEDj1off.py
fi

if [ -s /home/user1/ping_failures.log ]; then
python /home/user1/Desktop/LEDr1on.py
else
python /home/user1/Desktop/LEDr1off.py
fi

if [ -s /home/user1/ping_failures.log ]; then
python /home/user1/Desktop/LEDv1off.py
else
python /home/user1/Desktop/LEDv1on.py
fi

sleep 1
done
(36-36/47)