add: kubernetes log tailer
This commit is contained in:
@@ -6,7 +6,6 @@ import (
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"tipsy.codes/charles/mc-god/v2/internal/pkg/rcon"
|
||||
)
|
||||
@@ -43,50 +42,4 @@ func main() {
|
||||
log.Fatalf("Health check failed: %v", err)
|
||||
}
|
||||
log.Println("Connected successfully!")
|
||||
|
||||
// Example usage of various RCON functions
|
||||
log.Println("Executing sample commands...")
|
||||
|
||||
// Get server info
|
||||
info, err := client.GetServerInfo()
|
||||
if err != nil {
|
||||
log.Printf("Failed to get server info: %v", err)
|
||||
} else {
|
||||
log.Printf("Server info: %s", info)
|
||||
}
|
||||
|
||||
// Set weather to clear
|
||||
if err := client.SetWeather("clear"); err != nil {
|
||||
log.Printf("Failed to set weather: %v", err)
|
||||
} else {
|
||||
log.Println("Weather set to clear")
|
||||
}
|
||||
|
||||
// Set time to day
|
||||
if err := client.SetTime("day"); err != nil {
|
||||
log.Printf("Failed to set time: %v", err)
|
||||
} else {
|
||||
log.Println("Time set to day")
|
||||
}
|
||||
|
||||
// Set difficulty to normal
|
||||
if err := client.SetDifficulty("normal"); err != nil {
|
||||
log.Printf("Failed to set difficulty: %v", err)
|
||||
} else {
|
||||
log.Println("Difficulty set to normal")
|
||||
}
|
||||
|
||||
// Example of executing a custom command
|
||||
response, err := client.ExecuteWithTimeout("list", 5*time.Second)
|
||||
if err != nil {
|
||||
log.Printf("Failed to execute 'list' command: %v", err)
|
||||
} else {
|
||||
log.Printf("Players list response: %s", response)
|
||||
}
|
||||
|
||||
// Keep the application running until interrupted
|
||||
log.Println("MC God is now running. Press Ctrl+C to stop.")
|
||||
<-ctx.Done()
|
||||
|
||||
log.Println("MC God stopped gracefully.")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user