1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-28 18:22:02 +08:00
This commit is contained in:
IT 老营长 @云轩领航-创始人 2022-08-28 18:14:41 +08:00
parent 31fdb8af5a
commit d8310d576b
2 changed files with 12 additions and 13 deletions

View File

@ -38,10 +38,10 @@ func init() {
m.Cmd(FOREVER, STOP) m.Cmd(FOREVER, STOP)
if len(arg) > 0 && arg[0] == "space" { if len(arg) > 0 && arg[0] == "space" {
m.Cmdy(FOREVER, kit.Select(os.Args[0], nfs.PWD+ice.BIN_ICE_BIN, nfs.ExistsFile(m, ice.BIN_ICE_BIN)), m.Cmdy(FOREVER, kit.Select(os.Args[0], ice.BIN_ICE_BIN, nfs.ExistsFile(m, ice.BIN_ICE_BIN)),
"space", "dial", ice.DEV, ice.OPS, arg[2:]) "space", "dial", ice.DEV, ice.OPS, arg[2:])
} else { } else {
m.Cmdy(FOREVER, kit.Select(os.Args[0], nfs.PWD+ice.BIN_ICE_BIN, nfs.ExistsFile(m, ice.BIN_ICE_BIN)), m.Cmdy(FOREVER, kit.Select(os.Args[0], ice.BIN_ICE_BIN, nfs.ExistsFile(m, ice.BIN_ICE_BIN)),
"serve", START, ice.DEV, "", aaa.USERNAME, aaa.ROOT, aaa.PASSWORD, aaa.ROOT, arg) "serve", START, ice.DEV, "", aaa.USERNAME, aaa.ROOT, aaa.PASSWORD, aaa.ROOT, arg)
} }
}}, }},
@ -64,12 +64,7 @@ func init() {
logs.Println(ice.EXIT) // 正常退出 logs.Println(ice.EXIT) // 正常退出
break break
} else { } else {
if logs.Println(); nfs.ExistsFile(m, "var/log/bench.log") { logs.Println()
nfs.Rename(m, "var/log/bench.log", kit.Format("var/log/bench.%s.log", logs.Now().Format("20060102-150405")))
}
if logs.Println(); nfs.ExistsFile(m, "var/log/error.log") {
nfs.Rename(m, "var/log/error.log", kit.Format("var/log/error.%s.log", logs.Now().Format("20060102-150405")))
}
} }
} }
}}, }},

View File

@ -115,7 +115,11 @@ func PushPodCmd(m *ice.Message, cmd string, arg ...string) {
}) })
} }
func OptionAgentIs(m *ice.Message, arg ...string) bool { type Message interface {
Option(key string, arg ...ice.Any) string
}
func OptionAgentIs(m Message, arg ...string) bool {
for _, k := range arg { for _, k := range arg {
if strings.HasPrefix(m.Option(ice.MSG_USERUA), k) { if strings.HasPrefix(m.Option(ice.MSG_USERUA), k) {
return true return true
@ -123,15 +127,15 @@ func OptionAgentIs(m *ice.Message, arg ...string) bool {
} }
return false return false
} }
func OptionUserWeb(m *ice.Message) *url.URL { func OptionUserWeb(m Message) *url.URL {
return kit.ParseURL(m.Option(ice.MSG_USERWEB)) return kit.ParseURL(m.Option(ice.MSG_USERWEB))
} }
func MergeURL2(m *ice.Message, url string, arg ...ice.Any) string { func MergeURL2(m Message, url string, arg ...ice.Any) string {
return kit.MergeURL2(m.Option(ice.MSG_USERWEB), url, arg...) return kit.MergeURL2(m.Option(ice.MSG_USERWEB), url, arg...)
} }
func MergeLink(m *ice.Message, url string, arg ...ice.Any) string { func MergeLink(m Message, url string, arg ...ice.Any) string {
return strings.Split(MergeURL2(m, url, arg...), "?")[0] return strings.Split(MergeURL2(m, url, arg...), "?")[0]
} }
func MergePod(m *ice.Message, pod string, arg ...ice.Any) string { func MergePod(m Message, pod string, arg ...ice.Any) string {
return kit.MergePOD(kit.Select(ice.Info.Domain, m.Option(ice.MSG_USERWEB)), pod, arg...) return kit.MergePOD(kit.Select(ice.Info.Domain, m.Option(ice.MSG_USERWEB)), pod, arg...)
} }