set timeout for wget and kill slow processes

(e.g. in case controller is turned off)
This commit is contained in:
root 2017-03-16 22:44:08 +00:00
parent 478f9224de
commit 5b8b44bc3d
1 changed files with 2 additions and 2 deletions

View File

@ -98,7 +98,7 @@ case "$ROOM_NUMBER" in
DR=$(sign $(($R_-$R))); DG=$(sign $(($G_-$G))); DB=$(sign $(($B_-$B)))
R=$(($R+$DR)); G=$((G+$DG)); B=$(($B+$DB))
for i in 5:$R 4:$G 3:$B; do
wget -q -O- http://172.23.92.5/ecmd?channel%20$(echo $i | cut -d: -f1)%20$(echo $i | cut -d: -f2) > /dev/null 2>&1 &
wget -q --timeout 3 -O- http://172.23.92.5/ecmd?channel%20$(echo $i | cut -d: -f1)%20$(echo $i | cut -d: -f2) > /dev/null 2>&1 &
COLOR_B_TMP="$(echo "$COLOR_B_TMP" | cut -c3-)"
done
sleep .1
@ -109,7 +109,7 @@ case "$ROOM_NUMBER" in
else
COLOR_B_TMP=$COLOR_B
for i in 5 4 3; do
wget -q -O- http://172.23.92.5/ecmd?channel%20$i%20$(printf "%d" "0x${COLOR_B_TMP:0:2}") > /dev/null 2>&1 &
wget -q --timeout 3 -O- http://172.23.92.5/ecmd?channel%20$i%20$(printf "%d" "0x${COLOR_B_TMP:0:2}") > /dev/null 2>&1 &
COLOR_B_TMP="$(echo "$COLOR_B_TMP" | cut -c3-)"
done
fi