Uptime.tcl

Text Detected Guest 7 Views Size: 1.25 KB Posted on: Mar 24, 26 @ 1:49 PM
  1. # uptime.tcl by Jobe
  2. # 2008
  3.  
  4.  
  5. bind pub - !uptime doUptime
  6. bind pub - !botup doBotUp
  7.  
  8. setudef flag uptime
  9.  
  10. proc doUptime {nick uhost hand chan arg} {
  11.   if {![channel get $chan "uptime"]} { return }
  12.  
  13.   global botnick
  14.   if {[llength [join $arg]] > 0} {
  15.     if {[string compare -nocase [lindex [join $arg] 0] $botnick]} {
  16.       return
  17.     }
  18.   }
  19.  
  20.   catch {exec uptime} uptime
  21.   catch {exec hostname} hostname
  22.   set osver [lindex [unames] 0]
  23.   putquick "PRIVMSG $chan :Uptime for $hostname ($osver): $uptime"
  24. }
  25.  
  26. proc doBotUp {nick uhost hand chan arg} {
  27.   if {![channel get $chan "uptime"]} { return }
  28.  
  29.   global botnick
  30.   if {[llength [join $arg]] > 0} {
  31.     if {[string compare -nocase [lindex [join $arg] 0] $botnick]} {
  32.       return
  33.     }
  34.   }
  35.  
  36. bind pub - !mem pub:memusage
  37.  proc pub:memusage {nick host hand chan text} {
  38.      set mem [exec free -m | grep Mem: | awk {{print $3/1024}}]
  39.      putquick "PRIVMSG $chan :Memory usage: $mem GB"
  40. }
  41.   global uptime
  42.   global server-online
  43.  
  44.   set myuptime [duration [expr [clock seconds] - $uptime]]
  45.   set myonline [duration [expr [clock seconds] - ${server-online}]]
  46.  
  47.   putquick "PRIVMSG $chan :I have been running for $myuptime"
  48.   putquick "PRIVMSG $chan :I have been connected for $myonline"
  49. }

Raw Paste

Comments 0
Login to post a comment.
  • No comments yet. Be the first.
Login to post a comment. Login or Register
We use cookies. To comply with GDPR in the EU and the UK we have to show you these.

We use cookies and similar technologies to keep this website functional (including spam protection via Google reCAPTCHA or Cloudflare Turnstile), and — with your consent — to measure usage and show ads. See Privacy.