feat(watchdog): initialize watchdog connection and sync running instances
This commit is contained in:
+6
-6
@@ -394,11 +394,11 @@ func IsInstanceRunning(instanceID int) error {
|
||||
if strings.Contains(outputStr, "RUNNING") {
|
||||
postLog.Info(fmt.Sprintf("[IsInstanceRunning] Windows service %s is running", instance.Name))
|
||||
return nil
|
||||
} else {
|
||||
postLog.Info(fmt.Sprintf("[IsInstanceRunning] Windows service %s is stopped", instance.Name))
|
||||
return nil
|
||||
}
|
||||
|
||||
postLog.Info(fmt.Sprintf("[IsInstanceRunning] Windows service %s is stopped", instance.Name))
|
||||
return fmt.Errorf("service %s is not running", serviceName)
|
||||
|
||||
case "systemd":
|
||||
cmd := exec.Command("systemctl", "status", serviceName)
|
||||
|
||||
@@ -465,13 +465,13 @@ func IsInstanceRunning(instanceID int) error {
|
||||
|
||||
if strings.Contains(outputStr, "is running") {
|
||||
return nil
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
|
||||
return fmt.Errorf("service %s is not running", serviceName)
|
||||
|
||||
default:
|
||||
postLog.Error(fmt.Sprintf("[IsInstanceRunning] Unsupported init system: %s", initType))
|
||||
return nil
|
||||
return fmt.Errorf("unsupported init system: %s", initType)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user