forked from bambrman/yota
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpingsh.sh
59 lines (54 loc) · 930 Bytes
/
pingsh.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/ash
login="USER"
psw="PASSWORD"
speedon="5500"
speedoff="320"
x=1
f=""
for pr in $(strings pings)
do
ping -c 1 $pr
x=$(($x*$?))
done
if [ $x -eq 1 ]
then
#повторно опросим на случай пропадания wifi
f=$(cat flag)
if [ "$f" = "0" ]
then
exit 0 # inet is down already
fi
sleep 180
x=1;
for pr in $(strings pings)
do
ping -c 1 $pr
x=$(($x*$?))
done
if [ $x -eq 1 ]
then
logger -t YOTA "Speed OFF"
i=`yota.sh $login $psw $speedoff`
RETVAL=$?
echo $i
if [ $RETVAL -eq 0 ]
then
echo "0" > flag
fi
fi
else
echo 'aps is here'
f=$(cat flag)
if [ "$f" = "0" ]
then
logger -t YOTA "Speed ON"
i=`yota.sh $login $psw $speedon`
RETVAL=$?
echo $RETVAL
echo $i
if [ $RETVAL -eq 0 ]
then
echo "1" > flag
fi
fi
fi