Skip to content

Commit

Permalink
Try to update from systemd and old version correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
nkryuchkov committed Jun 4, 2020
1 parent 7dc3bed commit a51fece
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions cmd/skywire-visor/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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()")
Expand Down

0 comments on commit a51fece

Please sign in to comment.