Skip to content

Commit

Permalink
zimbraHealth: fix CheckZimbraServices()
Browse files Browse the repository at this point in the history
  • Loading branch information
kreatoo committed Jan 5, 2025
1 parent 09ab426 commit 6c2bafc
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions zimbraHealth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,7 @@ func RestartZimbraService(service string) {
func CheckZimbraServices() {
var zimbraServices []string

status, err := ExecZimbraCommand("zmcontrol status")

if err != nil {
common.LogError("Error getting zimbra status: " + err.Error())
return
}
status, _ := ExecZimbraCommand("zmcontrol status")

for _, service := range strings.Split(status, "\n")[1:] {
svc := strings.Join(strings.Fields(service), " ")
Expand Down Expand Up @@ -351,7 +346,7 @@ func ExecZimbraCommand(command string) (string, error) {
cmd.Run()

if cmd.ProcessState.ExitCode() != 0 {
return "", fmt.Errorf("Command failed: " + command)
return out.String(), fmt.Errorf("Command failed: " + command + " with stdout: " + out.String())
}

return out.String(), nil
Expand Down

0 comments on commit 6c2bafc

Please sign in to comment.