storj/cmd/storagenode-updater/restart.go
Yaroslav Vorobiov 4783c3e1d3 storagenode-updater/linux: restart systemd service
Change-Id: I8ac25ecc41323ec0d5abf8ee65276c1d7a59f74d
2020-09-02 06:22:19 +00:00

31 lines
647 B
Go

// Copyright (C) 2020 Storj Labs, Inc.
// See LICENSE for copying information.
// +build !service
package main
import (
"context"
"os"
"github.com/spf13/cobra"
"github.com/zeebo/errs"
)
func cmdRestart(cmd *cobra.Command, args []string) error {
return nil
}
func restartService(ctx context.Context, service, binaryLocation, newVersionPath, backupPath string) error {
if err := os.Rename(binaryLocation, backupPath); err != nil {
return errs.Wrap(err)
}
if err := os.Rename(newVersionPath, binaryLocation); err != nil {
return errs.Combine(err, os.Rename(backupPath, binaryLocation), os.Remove(newVersionPath))
}
return nil
}