c4d5625965
Change-Id: I7ed76b80a1df0ef53f2dd6726a602cc3bd4df9de
31 lines
671 B
Go
31 lines
671 B
Go
// Copyright (C) 2020 Storj Labs, Inc.
|
|
// See LICENSE for copying information.
|
|
|
|
// +build !service !windows,!linux,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
|
|
}
|