From 4e928f3426f7fb34d050174eda14592dbe5a44a4 Mon Sep 17 00:00:00 2001 From: mountain Date: Wed, 5 Jun 2024 15:33:09 +0900 Subject: [PATCH] =?UTF-8?q?autorun=20=ED=83=80=EC=9D=B4=EB=B0=8D=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD.=20Query=EB=A5=BC=20=EB=A8=BC=EC=A0=80=20?= =?UTF-8?q?=EB=B3=B4=EB=82=B4=EA=B3=A0=20=ED=95=B4=EC=95=BC=20=ED=95=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/client.go | 55 +++++++++++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/client/client.go b/client/client.go index 276f9d1..0b1b875 100644 --- a/client/client.go +++ b/client/client.go @@ -327,32 +327,6 @@ func NewClient(standalone bool) (HoustonClient, error) { case newClient := <-hc.clientChan: op = protos.NewOperationClient(newClient) - if autorun != nil && len(*autorun) > 0 { - hascount := strings.Split(*autorun, "/") - var service string - count := 1 - if len(hascount) > 1 { - service = hascount[0] - count, _ = strconv.Atoi(hascount[1]) - } else { - service = *autorun - } - - if cmd, ok := hc.config.Autorun[service]; ok { - // service 서비스 - for i := 0; i < count; i++ { - sr := shared.StartProcessRequest{ - Name: service, - Version: cmd.Version, - Args: append([]string{cmd.Exec}, cmd.Args...), - } - - if err := hc.startChildProcess(&sr, op); err != nil { - logger.Println("startChildProcess failed by autorun :", err) - } - } - } - } case exited := <-exitChan: var newprocs []*procmeta @@ -616,6 +590,35 @@ func (hc *houstonClient) checkOperation(client *grpc.ClientConn) error { return err } + if autorun != nil && len(*autorun) > 0 { + hascount := strings.Split(*autorun, "/") + var service string + count := 1 + if len(hascount) > 1 { + service = hascount[0] + count, _ = strconv.Atoi(hascount[1]) + } else { + service = *autorun + } + + if cmd, ok := hc.config.Autorun[service]; ok { + // service 서비스 + for i := 0; i < count; i++ { + sr := shared.StartProcessRequest{ + Name: service, + Version: cmd.Version, + Args: append([]string{cmd.Exec}, cmd.Args...), + } + + if err := hc.startChildProcess(&sr, op); err != nil { + logger.Println("startChildProcess failed by autorun :", err) + } else { + logger.Println("autorun success :", sr) + } + } + } + } + for { update, err := cl.Recv() if err != nil {