diff --git a/services/cmd/main.go b/services/cmd/main.go index 623f1b838..c27ea7723 100644 --- a/services/cmd/main.go +++ b/services/cmd/main.go @@ -183,22 +183,26 @@ func convertServiceSttings(config *comm.GameConfig, id int, sconfig *comm.Servic //启动服务程序 func startService(sseting *core.ServiceSttings) (err error) { var ( - cmd *exec.Cmd + cmd *exec.Cmd + command string + confpath string = fmt.Sprintf("./conf/%s.yaml", sseting.Id) ) switch sseting.Type { case comm.Service_Gateway: //网关服务 - cmd = exec.Command("./stup.sh", "start", sseting.Id, "gateway", fmt.Sprintf("./conf/%s.yaml", sseting.Id)) + command = fmt.Sprintf("./stup.sh start %s gateway %s", sseting.Id, confpath) break case comm.Service_Worker: //业务服务 - cmd = exec.Command("./stup.sh", "start", sseting.Id, "worker", fmt.Sprintf("./conf/%s.yaml", sseting.Id)) + command = fmt.Sprintf("./stup.sh start %s worker %s", sseting.Id, confpath) break case comm.Service_Mainte: //维护服务 - cmd = exec.Command("./stup.sh", "start", sseting.Id, "mainte", fmt.Sprintf("./conf/%s.yaml", sseting.Id)) + command = fmt.Sprintf("./stup.sh start %s mainte %s", sseting.Id, confpath) break default: err = fmt.Errorf("服务类型异常 stype:%s", sseting.Type) return } + log.Debug("启动外部命令", log.Field{Key: "cmd", Value: command}) + cmd = exec.Command("/bin/bash", "-c", command) err = cmd.Run() return }