package proc import ( "analysis/logo" "analysis/util" "context" ) func reaper(ctxt context.Context) { pidChan := make(chan int, 1) Reap(pidChan) go waitForRestart(ctxt, pidChan) } // MasterRole master func MasterRole(ctx context.Context) bool { reaper(ctx) util.InitDBAPI() sdks := util.SDKInfo() for k, v := range sdks { args := []string{ `-role=slave`, "-sdk=" + v.SdkType, "-id=" + v.IpcId, } args = append(args, (*util.GetParams())...) pid, err := runProc(ctx, "./analysis", args) if err != nil { logo.Errorf("ANALYSIS START SLAVE PROC %s IPC: %s error %+v\n", v.SdkType, v.IpcId, err) } logo.Infof("START %d PROC %d SDK %s ID %s\n", k, pid, v.IpcId, v.SdkType) } return true }