BASH Script:displays total download usage in specified time

Write tutorials here
There are more tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Please don't add support questions to tutorials,start your own thread in the appropriate sub-forum instead. Before you post please read this

Re: BASH Script:displays total download usage in specified t

Postby Habitual on Sun Aug 05, 2012 8:15 am

This sums up net usage quite nicely by the hour...
Code: Select all
#!/bin/bash
echo "Tx (MiB) for this hour is" $(for i in `date +%H` ; do vnstat --dumpdb | \grep "h;$i" ; done | cut -c 17- | cut -d\; -f1)
echo "Rx (MiB) for this hour is" $(for i in `date +%H` ; do vnstat --dumpdb | \grep "h;$i" ; done | cut -c 17- | cut -d\; -f2)


You'll need to install something to make that work, I will leave that up to you to figure out.
If you can't find an answer at Google, you must be typing in Braille.
User avatar
Habitual
Level 10
Level 10
 
Posts: 3480
Joined: Sun Nov 21, 2010 8:31 pm
Location: Youngstown, Ohio

Linux Mint is funded by ads and donations.
 

Re: BASH Script:displays total download usage in specified t

Postby coonhunter on Sun Aug 05, 2012 8:49 am

Habitual wrote:This sums up net usage quite nicely by the hour...
Code: Select all
#!/bin/bash
echo "Tx (MiB) for this hour is" $(for i in `date +%H` ; do vnstat --dumpdb | \grep "h;$i" ; done | cut -c 17- | cut -d\; -f1)
echo "Rx (MiB) for this hour is" $(for i in `date +%H` ; do vnstat --dumpdb | \grep "h;$i" ; done | cut -c 17- | cut -d\; -f2)


You'll need to install something to make that work, I will leave that up to you to figure out.
Last edited by coonhunter on Sun Aug 12, 2012 5:12 pm, edited 1 time in total.
coonhunter
Level 1
Level 1
 
Posts: 8
Joined: Thu Aug 25, 2011 4:26 pm

Re: BASH Script:displays total download usage in specified t

Postby Habitual on Sun Aug 05, 2012 8:55 am

Habitual wrote:...I will leave that up to you to figure out.
If you can't find an answer at Google, you must be typing in Braille.
User avatar
Habitual
Level 10
Level 10
 
Posts: 3480
Joined: Sun Nov 21, 2010 8:31 pm
Location: Youngstown, Ohio


Return to Tutorials

Who is online

Users browsing this forum: No registered users and 7 guests