aboutsummaryrefslogtreecommitdiffstats
path: root/config/servicewatchdog/servicewatchdog.inc
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2014-04-25 14:27:50 -0400
committerjim-p <jimp@pfsense.org>2014-04-25 14:27:50 -0400
commit8effac5182368b998e3866ab1eae58828188ca9e (patch)
tree8e90d6b0939f897a813732598fb48cf4b0d4984e /config/servicewatchdog/servicewatchdog.inc
parent79665700e2b26e544f574b339a4e60d047979919 (diff)
downloadpfsense-packages-8effac5182368b998e3866ab1eae58828188ca9e.tar.gz
pfsense-packages-8effac5182368b998e3866ab1eae58828188ca9e.tar.bz2
pfsense-packages-8effac5182368b998e3866ab1eae58828188ca9e.zip
Add option to send e-mail notifications when Service Watchdog restarts a service; Bump version.
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);
}
}