Skip to content

Commit 5337c70

Browse files
committed
early restart node after dump
1 parent 79a70d6 commit 5337c70

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

cmd/node/dump_snapshot/dump_snapshot.go

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,18 @@ func GetDumpSnapshotCmd() *cobra.Command {
239239
_ = os.Remove(outputFileName)
240240
})
241241

242+
if !noService {
243+
// restart the service
244+
fmt.Println("INF: restarting service")
245+
ec = utils.LaunchApp("sudo", []string{"systemctl", "restart", serviceName})
246+
if ec != 0 {
247+
utils.PrintlnStdErr("ERR: failed to restart service")
248+
exitWithError = true
249+
return
250+
}
251+
time.Sleep(15 * time.Second)
252+
}
253+
242254
fmt.Println("INF: restoring into", dumpHomeDir)
243255
ec = utils.LaunchApp(binary, []string{
244256
"snapshots", "load", outputFileName,
@@ -292,15 +304,6 @@ func GetDumpSnapshotCmd() *cobra.Command {
292304
registeredCleanup = append(registeredCleanup, func() {
293305
_ = launchCmd.Process.Kill()
294306
})
295-
} else {
296-
fmt.Println("INF: restarting service")
297-
ec = utils.LaunchApp("sudo", []string{"systemctl", "restart", serviceName})
298-
if ec != 0 {
299-
utils.PrintlnStdErr("ERR: failed to restart service")
300-
exitWithError = true
301-
return
302-
}
303-
time.Sleep(5 * time.Second)
304307
}
305308

306309
rpc, err := types.ReadNodeRpcFromConfigToml(path.Join(nodeHomeDirectory, "config", "config.toml"))

0 commit comments

Comments
 (0)