diff options
author | Niklas Yann Wettengel <niyawe@niyawe.de> | 2018-03-04 17:50:19 +0100 |
---|---|---|
committer | Niklas Yann Wettengel <niyawe@niyawe.de> | 2018-03-04 17:50:19 +0100 |
commit | a85999dbacc7d6a26332955e6518ae495797e85e (patch) | |
tree | 1488bf5a94103b44cfad86dc9ef8f656a61e84a0 /roles/install_monitoring/files/check_internet.sh | |
parent | aa0593233ec2470120b2655f3ba2ac28d7a4c5ee (diff) |
install vnstat
Diffstat (limited to 'roles/install_monitoring/files/check_internet.sh')
-rwxr-xr-x | roles/install_monitoring/files/check_internet.sh | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/roles/install_monitoring/files/check_internet.sh b/roles/install_monitoring/files/check_internet.sh deleted file mode 100755 index 5fbe0c2..0000000 --- a/roles/install_monitoring/files/check_internet.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - -INTERFACE=mullvad -FAILED_FILE=/tmp/mullvad.failed -fail=false - -if [ ! -e /sys/class/net/$INTERFACE ]; then - echo "$INTERFACE interface does not exist" - fail=true -else - start_bytes=$(cat /sys/class/net/$INTERFACE/statistics/rx_bytes) - sleep 30 - end_bytes=$(cat /sys/class/net/$INTERFACE/statistics/rx_bytes) - - if [ $(($end_bytes-$start_bytes)) -lt 1000 ]; then - #echo "no traffic via $INTERFACE" - fail=true - fi -fi - -if $fail; then - systemctl is-active openvpn-client@mullvad.service > /dev/null - if [ $? -ne 0 ]; then - systemctl status openvpn-client@mullvad.service - if [ -e $FAILED_FILE ]; then - echo restart openvpn-client@mullvad.service - systemctl restart openvpn-client@mullvad.service - else - touch $FAILED_FILE - fi - fi -else - if [ -e $FAILED_FILE ]; then - rm $FAILED_FILE - fi -fi - |