feat: 支持强制daemon

This commit is contained in:
Mmx
2021-12-01 22:24:19 +08:00
parent 4fc8a5f8c1
commit b39f12c17c
2 changed files with 3 additions and 1 deletions

View File

@@ -48,7 +48,7 @@ func EnterGuardian() {
util.Log.OutPut = true
global.Status.Guardian = true
util.Log.Println("[Guardian mode]")
if global.Config.Settings.Daemon.Enable {
if global.Config.Settings.Daemon.Enable || global.Flags.Daemon {
if err := exec.Command(os.Args[0], "-running-daemon").Start(); err != nil {
util.Log.Fatalln(err)
}

View File

@@ -7,10 +7,12 @@ import (
var Flags struct {
Path string
RunningDaemon bool
Daemon bool
}
func initFlags() {
flag.StringVar(&Flags.Path, "config", "Config.json", "config path")
flag.BoolVar(&Flags.RunningDaemon, "running-daemon", false, "")
flag.BoolVar(&Flags.Daemon, "daemon", false, "")
flag.Parse()
}