feat(watchdog): initialize watchdog connection and sync running instances

This commit is contained in:
2026-05-10 17:40:01 +08:00
parent ef27e7e0a9
commit e063a36e28
4 changed files with 54 additions and 18 deletions
+6 -6
View File
@@ -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)
}
}