| View previous topic :: View next topic |
| Author |
Message |
TaRgEt Voice
Joined: 27 Sep 2005 Posts: 4
|
Posted: Wed Feb 01, 2006 10:31 pm Post subject: convert mb into gb |
|
|
i hav vnstat running on my eggy n one thing i've neva been able to find is a script to convert the mb into gb on the eggy my script is:
| Code: |
bind pub -|- !vnstat vnstat
set slavename "00"
proc vnstat {nick uhost hand chan text} {
global slavename
if {([string match $slavename [string toupper [lindex $text 0]]]) || ([string match [string toupper [lindex $text 0]] ""])} {
set date [clock format [clock seconds] -format "%b '%y" -gmt 0]
set month [lindex [split "[exec vnstat -m]" "\n"] end-2]
set mb [lrange $month end-1 end-1]
putserv "PRIVMSG $chan :During \002$date\002 we have used $mb "
}
}
|
and output is:
| Code: |
During Feb '06 we have used 3,535 MB
|
if someone could edit my script so it converts the MB into GB it would be greatly appreicated
Last edited by TaRgEt on Thu Feb 02, 2006 8:43 am; edited 1 time in total |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Thu Feb 02, 2006 2:18 am Post subject: |
|
|
_________________ connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code |
|
| Back to top |
|
 |
TaRgEt Voice
Joined: 27 Sep 2005 Posts: 4
|
Posted: Thu Feb 02, 2006 8:40 am Post subject: |
|
|
i've tried it demond but that just won't work  |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Thu Feb 02, 2006 11:46 pm Post subject: |
|
|
strip commas from $mb:
| Code: |
set gb [expr [string map {, {}} $mb] / 1024.]
|
_________________ connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code |
|
| Back to top |
|
 |
TaRgEt Voice
Joined: 27 Sep 2005 Posts: 4
|
Posted: Fri Feb 03, 2006 5:18 pm Post subject: |
|
|
works absolute perfect now demond
thx bud  |
|
| Back to top |
|
 |
|