Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bind pub - !cpu cpuv
- bind pub - !mem memv
- bind pub - !timerz listtimers
- proc listtimers {nick host handle chan arg} {
- if { $chan != "#staff" } { return }
- putserv "PRIVMSG $chan :[timers]"
- }
- proc cpuv {nick host handle chan arg} {
- global botnick
- if { $chan != "#staff" } { return }
- set load [exec cat /proc/loadavg]
- if { $arg == "all" || $arg == $botnick } { putserv "PRIVMSG $chan :$botnick LoadAvg:\002 \0034 [lindex $load 0] [lindex $load 1] [lindex $load 2]" }
- if { [lindex $load 1] > 0.80 } { putserv "PRIVMSG $chan :$botnick LoadAvg:\002 \0034 WARNING!! SERVER LOAD ABOVE 0.80 FOR THE PAST 5 MINUTES" }
- if { [llength [timers]] != 0 } { foreach timer [timers] { killtimer [lindex $timer end] } }
- timer 5 [list cpuv "$nick" "$host" "$handle" "$chan" "yep"]
- }
- proc memv {nick host handle chan arg} {
- global botnick
- if { $chan != "#staff" } { return }
- set load [exec free -m]
- if { $arg == "all" || $arg == $botnick } { putserv "PRIVMSG $chan :Free Memory on $botnick:\002 \0034 [expr 1000 - [lindex [lindex [split $load '\n'] 1] 2]]" }
- }
Advertisement
Add Comment
Please, Sign In to add comment