install vnstat
parent
aa0593233e
commit
a85999dbac
@ -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
|
||||
|
@ -1,22 +1,9 @@
|
||||
---
|
||||
- name: install vnstat
|
||||
include: install_vnstat.yml
|
||||
import_tasks: install_vnstat.yml
|
||||
|
||||
- name: add bash script to check internet
|
||||
copy:
|
||||
src: check_internet.sh
|
||||
dest: /usr/local/bin/check_internet.sh
|
||||
mode: 0744
|
||||
#- name: install ffmyk-influx
|
||||
# include: install_ffmyk-influx.yml
|
||||
|
||||
- name: add cronjob to check internet
|
||||
cron:
|
||||
name: check_internet
|
||||
user: root
|
||||
cron_file: fastd-api
|
||||
job: '/usr/local/bin/check_internet.sh'
|
||||
|
||||
- name: install ffmyk-influx
|
||||
include: install_ffmyk-influx.yml
|
||||
|
||||
- name: install munin
|
||||
include: install_munin.yml
|
||||
#- name: install munin
|
||||
# include: install_munin.yml
|
||||
|
Loading…
Reference in New Issue