This commit is contained in:
david 2024-03-02 00:17:29 +08:00
parent 8c6a6b03b9
commit 8c65287273
1 changed files with 5 additions and 2 deletions

View File

@ -10,6 +10,7 @@ import (
"git.apinb.com/bsm-sdk/engine/env" "git.apinb.com/bsm-sdk/engine/env"
"git.apinb.com/bsm-sdk/engine/utils" "git.apinb.com/bsm-sdk/engine/utils"
"git.apinb.com/bsm-sdk/engine/vars"
"github.com/modood/table" "github.com/modood/table"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -43,6 +44,7 @@ type PsTable struct {
Performance string Performance string
CurrentVersion string `table:"Current Version"` CurrentVersion string `table:"Current Version"`
RegisterVersion string `table:"Register Version"` RegisterVersion string `table:"Register Version"`
UpdatedAt string `table:"Updated At"`
} }
var psCmd = &cobra.Command{ var psCmd = &cobra.Command{
@ -72,6 +74,7 @@ func psExecute() {
srvLine.ServiceKey = v.ServiceKey srvLine.ServiceKey = v.ServiceKey
srvLine.Origin = v.Origin srvLine.Origin = v.Origin
srvLine.RegisterVersion = v.Version srvLine.RegisterVersion = v.Version
srvLine.UpdatedAt = v.UpdatedAt.Format(vars.YYYY_MM_DD_HH_MM_SS)
pt = append(pt, srvLine) pt = append(pt, srvLine)
} }
@ -84,12 +87,12 @@ func getSrvStatus(srv string) PsTable {
var status string = " - " var status string = " - "
binExists := utils.PathExists(env.MeshEnv.Prefix + srv) binExists := utils.PathExists(env.MeshEnv.Prefix + srv)
if binExists { if binExists {
status = "\033[32mRunning\033[0m\n" status = "\033[32mRunning\033[0m"
} }
isRun := checkProcessRunning(srv) isRun := checkProcessRunning(srv)
if binExists && !isRun { if binExists && !isRun {
status = "\033[31mStop\033[0m\n" status = "\033[31mStop\033[0m"
} }
pid, cm := getProcessInfo(srv) pid, cm := getProcessInfo(srv)