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 {