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