Browse Source

Add uptime command

master
HimbeerserverDE 1 year ago
parent
commit
4883552ecc
No known key found for this signature in database
GPG Key ID: 1A651504791E6A8B
  1. 9
      igutils.go
  2. 3
      signal.go

9
igutils.go

@ -2,6 +2,7 @@ package main
import (
"log"
"strconv"
"strings"
)
@ -497,6 +498,14 @@ func init() {
SendChatMsg(c, "Unbanned "+param)
})
RegisterChatCommand("uptime",
"Prints the uptime of the proxy. Usage: uptime",
nil,
true,
func(c *Conn, param string) {
SendChatMsg(c, "Uptime: "+strconv.FormatFloat(Uptime(), 'f', -1, 64)+"s")
})
RegisterOnRedirectDone(func(c *Conn, newsrv string, success bool) {
if success {
err := SetStorageKey("server:"+c.Username(), newsrv)

3
signal.go

@ -1,6 +1,7 @@
package main
import (
"log"
"os"
"os/signal"
"syscall"
@ -12,6 +13,8 @@ func init() {
signal.Notify(signalChan, os.Interrupt, syscall.SIGTERM)
<-signalChan
log.Print("Caught SIGINT or SIGTERM, shutting down")
End(false, false)
}()
}

Loading…
Cancel
Save