blob: 66a7974e74e12cf9ab6e719eac64193c1f59b86e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#!/bin/bash
ping -nq -W 1 -c 1 1.1.1.1 > /dev/null 2>&1
state=$?
oldstate=$state
while true; do
ping -nq -W 1 -c 1 1.1.1.1 > /dev/null 2>&1
state=$?
if [[ $oldstate -ne $state ]]; then
if [[ $state -eq 0 ]]; then
echo "Device went back online"
else
echo "Device went offline"
fi
fi
oldstate=$state
sleep 5
done
|