sftpgo-mirror/cmd/status_windows.go

36 lines
639 B
Go
Raw Permalink Normal View History

2019-09-16 06:52:58 +00:00
package cmd
import (
"fmt"
2020-06-20 12:30:46 +00:00
"os"
2019-09-16 06:52:58 +00:00
"github.com/spf13/cobra"
2021-06-26 05:31:41 +00:00
"github.com/drakkan/sftpgo/v2/service"
2019-09-16 06:52:58 +00:00
)
var (
statusCmd = &cobra.Command{
Use: "status",
Short: "Retrieve the status for the SFTPGo Windows Service",
Run: func(cmd *cobra.Command, args []string) {
s := service.WindowsService{
Service: service.Service{
Shutdown: make(chan bool),
},
}
status, err := s.Status()
if err != nil {
fmt.Printf("Error querying service status: %v\r\n", err)
2020-06-20 12:30:46 +00:00
os.Exit(1)
2019-09-16 06:52:58 +00:00
} else {
fmt.Printf("Service status: %#v\r\n", status.String())
}
},
}
)
func init() {
serviceCmd.AddCommand(statusCmd)
}