Skip to content

Commit

Permalink
变更uptime变量名
Browse files Browse the repository at this point in the history
  • Loading branch information
Jrohy committed Jun 24, 2022
1 parent 11520c0 commit fa8531a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ var versionCmd = &cobra.Command{
Use: "version",
Short: "显示版本号",
Run: func(cmd *cobra.Command, args []string) {
runTime := trojan.RunTime()
upTime := trojan.UpTime()
trojanVersion := trojan.Version()
fmt.Println()
fmt.Printf("Version: %s\n\n", util.Cyan(trojan.MVersion))
fmt.Printf("BuildDate: %s\n\n", util.Cyan(trojan.BuildDate))
fmt.Printf("GoVersion: %s\n\n", util.Cyan(trojan.GoVersion))
fmt.Printf("GitVersion: %s\n\n", util.Cyan(trojan.GitVersion))
fmt.Printf("TrojanVersion: %s\n\n", util.Cyan(trojanVersion))
fmt.Printf("TrojanRunTime: %s\n\n", util.Cyan(runTime))
fmt.Printf("TrojanUpTime: %s\n\n", util.Cyan(upTime))
},
}

Expand Down
4 changes: 2 additions & 2 deletions trojan/trojan.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ func Status(isPrint bool) string {
return result
}

// RunTime Trojan运行时间
func RunTime() string {
// UpTime Trojan运行时间
func UpTime() string {
result := strings.TrimSpace(util.ExecCommandWithResult("ps -Ao etime,args|grep -v grep|grep /usr/local/etc/trojan/config.json"))
resultSlice := strings.Split(result, " ")
if len(resultSlice) > 0 {
Expand Down
2 changes: 1 addition & 1 deletion web/controller/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func Version() *ResponseBody {
"goVersion": trojan.GoVersion,
"gitVersion": trojan.GitVersion,
"trojanVersion": trojan.Version(),
"trojanRuntime": trojan.RunTime(),
"trojanUptime": trojan.UpTime(),
"trojanType": trojan.Type(),
}
return &responseBody
Expand Down

0 comments on commit fa8531a

Please sign in to comment.