egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

convert mb into gb

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
TaRgEt
Voice


Joined: 27 Sep 2005
Posts: 4

PostPosted: Wed Feb 01, 2006 10:31 pm    Post subject: convert mb into gb Reply with quote

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
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Thu Feb 02, 2006 2:18 am    Post subject: Reply with quote

Code:

[expr $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
View user's profile Send private message Visit poster's website
TaRgEt
Voice


Joined: 27 Sep 2005
Posts: 4

PostPosted: Thu Feb 02, 2006 8:40 am    Post subject: Reply with quote

i've tried it demond but that just won't work Sad
Back to top
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Thu Feb 02, 2006 11:46 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
TaRgEt
Voice


Joined: 27 Sep 2005
Posts: 4

PostPosted: Fri Feb 03, 2006 5:18 pm    Post subject: Reply with quote

works absolute perfect now demond

thx bud Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber