dump指令

This commit is contained in:
ZhuoQinghui 2024-10-14 17:29:50 +08:00
parent 61744c7886
commit c33b8f0729
2 changed files with 16 additions and 0 deletions

View File

@ -80,3 +80,7 @@ func onStop() {
func onCommand(command string) {
}
func onConfig() {
}

View File

@ -1,6 +1,7 @@
package src
import (
"encoding/json"
"log"
"net"
"os"
@ -31,6 +32,8 @@ func Start() {
daemonStop()
case "status":
daemonStatus()
case "dump":
dumpConfig()
case "-s":
daemonCommand()
default:
@ -154,6 +157,15 @@ func daemonStatus() {
}
}
func dumpConfig() {
//config, err := json.Marshal(GetAppConfig())
config, err := json.MarshalIndent(GetAppConfig(), "", " ")
if err != nil {
log.Fatalf("Failed to marshal config: %v", err)
}
log.Println(string(config))
}
/*
守护进程接收名称
*/