diff --git a/cmd/skywire-visor/commands/root.go b/cmd/skywire-visor/commands/root.go index e3a6cd3d9a..60d44d3a13 100644 --- a/cmd/skywire-visor/commands/root.go +++ b/cmd/skywire-visor/commands/root.go @@ -8,6 +8,7 @@ import ( "net/http" _ "net/http/pprof" // nolint:gosec // https://golang.org/doc/diagnostics.html#profiling "os" + "os/exec" "strings" "syscall" "time" @@ -77,12 +78,14 @@ var rootCmd = &cobra.Command{ if delayDuration != 0 && !restartCtx.Systemd() && wd == "/" && path == "/usr/local/bin/skywire-visor" { // from v0.2.3 / parent is run by systemd - // cmd := exec.Command("systemctl", "restart", "skywire-visor") // nolint:gosec - // if err := cmd.Run(); err != nil { - // log.WithError(err).Errorf("Failed to restart skywire-visor service") - // } else { - // log.WithError(err).Infof("Restarted skywire-visor service") - // } + time.Sleep(1 * time.Second) + + cmd := exec.Command("systemctl", "restart", "skywire-visor") // nolint:gosec + if err := cmd.Run(); err != nil { + log.WithError(err).Errorf("Failed to restart skywire-visor service") + } else { + log.WithError(err).Infof("Restarted skywire-visor service") + } if _, err := syscall.Setsid(); err != nil { log.WithError(err).Errorf("Failed to call setsid()")