Actualizar 'vnstati.sh'

This commit is contained in:
borekon 2023-03-15 22:31:57 +00:00
parent ad6509694b
commit 1d7673d803

View File

@ -1,7 +1,7 @@
#!/bin/bash
if ! command -v vnstati >/dev/null; then echo "I require vnstati but it's not installed."; sudo apt install vnstati; else echo "vnstati OK"; fi;
if ! command -v sendmail >/dev/null; then echo "I require sendmail but it's not installed."; sudo apt install sendmail; else echo "sendmail OK"; fi;
if id -nG "$USER" | grep -qw "mail"; then echo ""; else sudo usermod -aG mail $USER; fi
if id -nG "$USER" | grep -qw "mail"; then echo "User in mail group"; else sudo usermod -aG mail $USER; fi
IFACE=$(ip -br l | awk '$1 !~ "lo|vir|vet|br|docker" { print $1}')
for i in $IFACE;do
vnstati -d 7 -i $i -o $i.png
@ -27,7 +27,7 @@ done
/usr/sbin/sendmail -t <<EOT
TO: alfonso@vivancos.eu
FROM: alfonso@cayuela.eu
FROM: $USER@$(hostname -A)
SUBJECT: $HOSTNAME traffic summary $(date +%c)
MIME-Version: 1.0
Content-Type: multipart/related;boundary="XYZ"