reload_windows.go 626 B

1234567891011121314151617181920212223242526272829303132333435
  1. package cmd
  2. import (
  3. "fmt"
  4. "os"
  5. "github.com/spf13/cobra"
  6. "github.com/drakkan/sftpgo/service"
  7. )
  8. var (
  9. reloadCmd = &cobra.Command{
  10. Use: "reload",
  11. Short: "Reload the SFTPGo Windows Service sending a \"paramchange\" request",
  12. Run: func(cmd *cobra.Command, args []string) {
  13. s := service.WindowsService{
  14. Service: service.Service{
  15. Shutdown: make(chan bool),
  16. },
  17. }
  18. err := s.Reload()
  19. if err != nil {
  20. fmt.Printf("Error sending reload signal: %v\r\n", err)
  21. os.Exit(1)
  22. } else {
  23. fmt.Printf("Reload signal sent!\r\n")
  24. }
  25. },
  26. }
  27. )
  28. func init() {
  29. serviceCmd.AddCommand(reloadCmd)
  30. }