UnixServerAdmin

Server Administration & Management

bandwidth.sh

###########################################################
## bandwidth.sh ##
###########################################################
## Make a Directory /REPORTS ##
## Make a file msg.txt under /REPORTS Directory ##
## Write Following in msg.txt file ##
###########################################################
## Hi, ##
## The Bndwidth Scan process the server has been completed. ##
## For Bandwidth Scan Report, please check the attached bandwidth Report. ##
## Thanks & Regards, ##
## Unixserveradmin.com Security Team ##
###########################################################
#! /bin/bash

/bin/echo “=========================================================” > /REPORTS/vnstat.log_$(date +%d%m%y)
/bin/echo “THE Bandwidth Report of virlnx3.Securehostdns.com at $(date)” >> /REPORTS/vnstat.log_$(date +%d%m%y)
/bin/echo “=========================================================” >> /REPORTS/vnstat.log_$(date +%d%m%y)

/bin/echo ”      ” >> /REPORTS/vnstat.log_$(date +%d%m%y)
/bin/echo ”      ” >> /REPORTS/vnstat.log_$(date +%d%m%y)
/bin/echo “========================================================” >> /REPORTS/vnstat.log_$(date +%d%m%y)
/bin/echo “Bandwidth Report by Day”  >> /REPORTS/vnstat.log_$(date +%d%m%y)
/bin/echo “————————–”  >> /REPORTS/vnstat.log_$(date +%d%m%y)
/usr/bin/vnstat -u -i eth0
/usr/bin/vnstat -d >> /REPORTS/vnstat.log_$(date +%d%m%y)
/bin/echo “——————————————————–” >> /REPORTS/vnstat.log_$(date +%d%m%y)

/bin/echo ”      ” >> /REPORTS/vnstat.log_$(date +%d%m%y)
/bin/echo ”      ” >> /REPORTS/vnstat.log_$(date +%d%m%y)
/bin/echo “========================================================” >> /REPORTS/vnstat.log_$(date +%d%m%y)
/bin/echo “Bandwidth Report by Hour”  >> /REPORTS/vnstat.log_$(date +%d%m%y)
/bin/echo “—————————”  >> /REPORTS/vnstat.log_$(date +%d%m%y)
/usr/bin/vnstat -h >> /REPORTS/vnstat.log_$(date +%d%m%y)
/bin/echo “——————————————————–” >> /REPORTS/vnstat.log_$(date +%d%m%y)

/bin/echo ”      ” >> /REPORTS/vnstat.log_$(date +%d%m%y)
/bin/echo ”      ” >> /REPORTS/vnstat.log_$(date +%d%m%y)
/bin/echo “========================================================” >> /REPORTS/vnstat.log_$(date +%d%m%y)
/bin/echo “Bandwidth Report by Month”  >> /REPORTS/vnstat.log_$(date +%d%m%y)
/bin/echo “—————————–”  >> /REPORTS/vnstat.log_$(date +%d%m%y)
/usr/bin/vnstat -m >> /REPORTS/vnstat.log_$(date +%d%m%y)
/bin/echo “—————————————————” >> /REPORTS/vnstat.log_$(date +%d%m%y)

mutt -s “Bandwidth Scan REPORT $(hostname | tr ‘a-z’ ‘A-Z’)” -a /REPORTS/vnstat.log_$(date +%d%m%y) unixserv@unixserveradmin.com < /REPORTS/msg.txt

mutt -s “Bandwidth Scan REPORT $(hostname | tr ‘a-z’ ‘A-Z’)” -a /REPORTS/vnstat.log_$(date +%d%m%y) info@unixserveradmin.com < /REPORTS/msg.txt

October 18, 2011 Posted by | Security, Shell Script, Tips & Tricks, Unix/Linux | , , , , , , | Leave a comment