2020-02-02 21:20:39 +00:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2020-06-20 12:30:46 +00:00
|
|
|
"os"
|
2020-02-02 21:20:39 +00:00
|
|
|
|
|
|
|
"github.com/spf13/cobra"
|
2020-05-06 17:36:34 +00:00
|
|
|
|
|
|
|
"github.com/drakkan/sftpgo/service"
|
2020-02-02 21:20:39 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
reloadCmd = &cobra.Command{
|
|
|
|
Use: "reload",
|
|
|
|
Short: "Reload the SFTPGo Windows Service sending a \"paramchange\" request",
|
|
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
|
|
s := service.WindowsService{
|
|
|
|
Service: service.Service{
|
|
|
|
Shutdown: make(chan bool),
|
|
|
|
},
|
|
|
|
}
|
|
|
|
err := s.Reload()
|
|
|
|
if err != nil {
|
2020-06-22 17:11:53 +00:00
|
|
|
fmt.Printf("Error sending reload signal: %v\r\n", err)
|
2020-06-20 12:30:46 +00:00
|
|
|
os.Exit(1)
|
2020-02-02 21:20:39 +00:00
|
|
|
} else {
|
2020-06-22 17:11:53 +00:00
|
|
|
fmt.Printf("Reload signal sent!\r\n")
|
2020-02-02 21:20:39 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
serviceCmd.AddCommand(reloadCmd)
|
|
|
|
}
|