aboutsummaryrefslogtreecommitdiffstats
path: root/config/servicewatchdog/servicewatchdog.inc
diff options
context:
space:
mode:
Diffstat (limited to 'config/servicewatchdog/servicewatchdog.inc')
-rw-r--r--config/servicewatchdog/servicewatchdog.inc6
1 files changed, 5 insertions, 1 deletions
diff --git a/config/servicewatchdog/servicewatchdog.inc b/config/servicewatchdog/servicewatchdog.inc
index 696e570e..5b638836 100644
--- a/config/servicewatchdog/servicewatchdog.inc
+++ b/config/servicewatchdog/servicewatchdog.inc
@@ -3,6 +3,7 @@ require_once("config.inc");
require_once("services.inc");
require_once("service-utils.inc");
require_once("util.inc");
+require_once("notices.inc");
function servicewatchdog_service_matches($svc1, $svc2) {
/* If the arrays are equal, it must be the same service. */
@@ -74,7 +75,10 @@ function servicewatchdog_check_services() {
foreach ($a_pwservices as $svc) {
if (!get_service_status($svc)) {
$descr = strlen($svc['description']) > 50 ? substr($svc['description'], 0, 50) . "..." : $svc['description'];
- log_error("Service Watchdog detected service {$svc['name']} stopped. Restarting {$svc['name']} ({$descr})");
+ $error_message = "Service Watchdog detected service {$svc['name']} stopped. Restarting {$svc['name']} ({$descr})";
+ log_error($error_message);
+ if (isset($svc['notify']))
+ notify_via_smtp($error_message);
service_control_start($svc['name'], $svc);
}
}