This commit is contained in:
lwl0608 2024-05-15 19:21:37 +08:00
parent dc1feac378
commit c03854b6d1
1 changed files with 10 additions and 3 deletions

View File

@ -5,6 +5,7 @@ import (
"fmt" "fmt"
"net/http" "net/http"
"os" "os"
"os/exec"
"os/signal" "os/signal"
"service/library/configcenter" "service/library/configcenter"
"service/library/servicediscovery" "service/library/servicediscovery"
@ -93,11 +94,17 @@ func registerSD(ip string, port int) error {
} }
func setServerStatusFD(status string) { func setServerStatusFD(status string) {
os.Setenv("SERVER_STATUS_FD", status) serverStatusFdPath := "/Users/erwin/SERVER_STATUS_FD"
fmt.Println(os.Getenv("SERVER_STATUS_FD")) cmd := exec.Command("echo", fmt.Sprintf("%s > %s", status, serverStatusFdPath))
err := cmd.Run()
if err != nil {
logger.Info("run cmd fail, p: %v, err: %v", serverStatusFdPath, err)
return
}
return return
serverStatusFdPath := "/Users/erwin/SERVER_STATUS_FD" serverStatusFdPath = "/Users/erwin/SERVER_STATUS_FD"
file, err := os.OpenFile(serverStatusFdPath, os.O_RDWR|os.O_CREATE, 0666) file, err := os.OpenFile(serverStatusFdPath, os.O_RDWR|os.O_CREATE, 0666)
if err != nil { if err != nil {
logger.Info("OpenFile fail, p: %v, err: %v", serverStatusFdPath, err) logger.Info("OpenFile fail, p: %v, err: %v", serverStatusFdPath, err)