From 8ee3d19485edb7ae7d9b4270b5e69efc2e55b5b0 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 1a04d2545..44a9a7c8f 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")