Browse Source

status

master
zeus 2 years ago
parent
commit
1d6e4376d5
  1. 16
      files/status-1.sh
  2. 12
      files/status.sh

16
files/status-1.sh

@ -0,0 +1,16 @@
#!/bin/bash
net=wg0
test_time=2
T1=$(cat /sys/class/net/$net/statistics/tx_bytes)
sleep $test_time
T2=$(cat /sys/class/net/$net/statistics/tx_bytes)
#echo "t2=$T2 t1=$T1"
tot=$(( (T2 - T1)))
if [ $tot -eq 0 ]; then
echo "1"
fi

12
files/status.sh

@ -4,7 +4,17 @@ function ifup {
if [[ ! -d /sys/class/net/${1} ]]; then
return 1
else
[[ $(</sys/class/net/${1}/carrier) == 1 ]]
net=${1}
test_time=2
T1=$(cat /sys/class/net/$net/statistics/tx_bytes)
sleep $test_time
T2=$(cat /sys/class/net/$net/statistics/tx_bytes)
tot=$(( (T2 - T1)))
if [ $tot -eq 0 ]; then
return 1
fi
fi
}

Loading…
Cancel
Save