From 5ca106d107cdd279330edd80017d0c51a5440bf5 Mon Sep 17 00:00:00 2001 From: Muhamad Azamy Date: Wed, 13 Dec 2023 10:12:19 +0100 Subject: [PATCH] make sure to pkill rmb before starting --- cmds/modules/noded/twin.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmds/modules/noded/twin.go b/cmds/modules/noded/twin.go index ef4d93c30..9222a42b5 100644 --- a/cmds/modules/noded/twin.go +++ b/cmds/modules/noded/twin.go @@ -38,7 +38,17 @@ func withDefaultPort(substrateUrl string) (string, error) { return u.String(), nil } +func pkill(ps string) error { + return exec.Command("pkill", "-9", ps).Run() +} + func runMsgBus(ctx context.Context, sk ed25519.PrivateKey, substrateURLs []string, relayAddr []string, redisAddr string) error { + // todo: this is a hack to make sure that no other rmb instances running on the node + // that are not managed by noded. I only saw this one time but no harm of being careful + if err := pkill("rmb"); err != nil { + log.Debug().Err(err).Msg("no rmb processes killed") + } + // select the first one as only one URL is set for now if len(substrateURLs) == 0 { return errors.New("at least one substrate URL must be provided")