aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/procwatch/procwatch.inc39
-rw-r--r--config/procwatch/procwatch_cron.php6
-rw-r--r--config/servicewatchdog/services_servicewatchdog.php (renamed from config/procwatch/services_procwatch.php)44
-rw-r--r--config/servicewatchdog/services_servicewatchdog_add.php (renamed from config/procwatch/services_procwatch_add.php)26
-rw-r--r--config/servicewatchdog/servicewatchdog.inc39
-rw-r--r--config/servicewatchdog/servicewatchdog.xml (renamed from config/procwatch/procwatch.xml)22
-rw-r--r--config/servicewatchdog/servicewatchdog_cron.php6
-rw-r--r--pkg_config.8.xml6
-rw-r--r--pkg_config.8.xml.amd646
9 files changed, 97 insertions, 97 deletions
diff --git a/config/procwatch/procwatch.inc b/config/procwatch/procwatch.inc
deleted file mode 100644
index b2210e03..00000000
--- a/config/procwatch/procwatch.inc
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-require_once("config.inc");
-require_once("services.inc");
-require_once("service-utils.inc");
-require_once("util.inc");
-
-function procwatch_cron_job() {
- global $config;
- if (!is_array($config['installedpackages']['procwatch']['item'])) {
- $config['installedpackages']['procwatch']['item'] = array();
- }
- $a_pwservices = &$config['installedpackages']['procwatch']['item'];
-
- if (count($a_pwservices) > 0) {
- // Add the cron job if it doesn't exist.
- install_cron_job("/usr/local/pkg/procwatch_cron.php", true, "*/1");
- } else {
- // Remove the cron job
- install_cron_job("/usr/local/pkg/procwatch_cron.php", false, "*/1");
- }
-}
-
-function procwatch_check_services() {
- global $config;
- if (!is_array($config['installedpackages']['procwatch']['item'])) {
- $config['installedpackages']['procwatch']['item'] = array();
- }
- $a_pwservices = &$config['installedpackages']['procwatch']['item'];
-
- foreach ($a_pwservices as $svc) {
- if (!is_service_running($svc['name'])) {
- $descr = strlen($svc['description']) > 50 ? substr($svc['description'], 0, 50) . "..." : $svc['description'];
- log_error("ProcWatch detected service {$svc['name']} stopped. Restarting {$svc['name']} ({$descr})");
- service_control_start($svc['name'], $svc);
- }
- }
-}
-
-?> \ No newline at end of file
diff --git a/config/procwatch/procwatch_cron.php b/config/procwatch/procwatch_cron.php
deleted file mode 100644
index f4cc7608..00000000
--- a/config/procwatch/procwatch_cron.php
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/usr/local/bin/php -f
-<?php
-require_once("procwatch.inc");
-
-procwatch_check_services();
-?> \ No newline at end of file
diff --git a/config/procwatch/services_procwatch.php b/config/servicewatchdog/services_servicewatchdog.php
index c8a16b07..920fd1bb 100644
--- a/config/procwatch/services_procwatch.php
+++ b/config/servicewatchdog/services_servicewatchdog.php
@@ -1,6 +1,6 @@
<?php
/*
- services_procwatch.php
+ services_servicewatchdog.php
Copyright (C) 2013 Jim Pingle
All rights reserved.
@@ -30,21 +30,21 @@
*/
##|+PRIV
-##|*IDENT=page-services-procwatch
-##|*NAME=Services: ProcWatch
-##|*DESCR=Allow access to the 'Services: ProcWatch' page.
-##|*MATCH=services_procwatch.php*
+##|*IDENT=page-services-servicewatchdog
+##|*NAME=Services: Service Watchdog
+##|*DESCR=Allow access to the 'Services: Service Watchdog' page.
+##|*MATCH=services_servicewatchdog.php*
##|-PRIV
require("guiconfig.inc");
require_once("functions.inc");
require_once("service-utils.inc");
-require_once("procwatch.inc");
+require_once("servicewatchdog.inc");
-if (!is_array($config['installedpackages']['procwatch']['item']))
- $config['installedpackages']['procwatch']['item'] = array();
+if (!is_array($config['installedpackages']['servicewatchdog']['item']))
+ $config['installedpackages']['servicewatchdog']['item'] = array();
-$a_pwservices = &$config['installedpackages']['procwatch']['item'];
+$a_pwservices = &$config['installedpackages']['servicewatchdog']['item'];
/* if a custom message has been passed along, lets process it */
if ($_GET['savemsg'])
@@ -53,9 +53,9 @@ if ($_GET['savemsg'])
if ($_GET['act'] == "del") {
if ($a_pwservices[$_GET['id']]) {
unset($a_pwservices[$_GET['id']]);
- procwatch_cron_job();
+ servicewatchdog_cron_job();
write_config();
- header("Location: services_procwatch.php");
+ header("Location: services_servicewatchdog.php");
exit;
}
}
@@ -66,9 +66,9 @@ if (isset($_POST['del_x'])) {
foreach ($_POST['pwservices'] as $servicei) {
unset($a_pwservices[$servicei]);
}
- procwatch_cron_job();
+ servicewatchdog_cron_job();
write_config();
- header("Location: services_procwatch.php");
+ header("Location: services_servicewatchdog.php");
exit;
}
} else {
@@ -108,15 +108,15 @@ if (isset($_POST['del_x'])) {
$a_pwservices_new[] = $a_pwservices[$i];
}
$a_pwservices = $a_pwservices_new;
- procwatch_cron_job();
+ servicewatchdog_cron_job();
write_config();
- header("Location: services_procwatch.php");
+ header("Location: services_servicewatchdog.php");
return;
}
}
$closehead = false;
-$pgtitle = array(gettext("Services"),gettext("ProcWatch"));
+$pgtitle = array(gettext("Services"),gettext("Service Watchdog"));
include("head.inc");
?>
@@ -129,7 +129,7 @@ include("head.inc");
</head>
<body link="#000000" vlink="#000000" alink="#000000">
<?php include("fbegin.inc"); ?>
-<form action="services_procwatch.php" method="post" name="iform">
+<form action="services_servicewatchdog.php" method="post" name="iform">
<script type="text/javascript" language="javascript" src="/javascript/row_toggle.js"></script>
<?php if ($savemsg) print_info_box($savemsg); ?>
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="services to monitor">
@@ -152,7 +152,7 @@ include("head.inc");
<input name="del" type="image" src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" title="<?=gettext("delete selected services"); ?>" onclick="return confirm('<?=gettext("Do you really want to delete the selected services?");?>')" />
<?php endif; ?>
</td>
- <td><a href="services_procwatch_add.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="<?=gettext("add new service"); ?>" alt="add" /></a></td>
+ <td><a href="services_servicewatchdog_add.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="<?=gettext("add new service"); ?>" alt="add" /></a></td>
</tr>
</table>
</td>
@@ -164,17 +164,17 @@ foreach ($a_pwservices as $thisservice):
?>
<tr valign="top" id="fr<?=$nservices;?>">
<td class="listt"><input type="checkbox" id="frc<?=$nservices;?>" name="pwservices[]" value="<?=$i;?>" onClick="fr_bgcolor('<?=$nservices;?>')" style="margin: 0; padding: 0; width: 15px; height: 15px;" /></td>
- <td class="listlr" onclick="fr_toggle(<?=$nservices;?>)" id="frd<?=$nservices;?>" ondblclick="document.location='services_procwatch_add.php?id=<?=$nservices;?>';">
+ <td class="listlr" onclick="fr_toggle(<?=$nservices;?>)" id="frd<?=$nservices;?>" ondblclick="document.location='services_servicewatchdog_add.php?id=<?=$nservices;?>';">
<?=$thisservice['name'];?>
</td>
- <td class="listr" onclick="fr_toggle(<?=$nservices;?>)" id="frd<?=$nservices;?>" ondblclick="document.location='services_procwatch_add.php?id=<?=$nservices;?>';">
+ <td class="listr" onclick="fr_toggle(<?=$nservices;?>)" id="frd<?=$nservices;?>" ondblclick="document.location='services_servicewatchdog_add.php?id=<?=$nservices;?>';">
<?=$thisservice['description'];?>
</td>
<td valign="middle" class="list" nowrap>
<table border="0" cellspacing="0" cellpadding="1" summary="add">
<tr>
<td><input onmouseover="fr_insline(<?=$nservices;?>, true)" onmouseout="fr_insline(<?=$nservices;?>, false)" name="move_<?=$i;?>" src="/themes/<?= $g['theme']; ?>/images/icons/icon_left.gif" title="<?=gettext("move selected services before this service");?>" height="17" type="image" width="17" border="0" /></td>
- <td align="center" valign="middle"><a href="services_procwatch.php?act=del&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this service?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" title="<?=gettext("delete service");?>" alt="delete" /></a></td>
+ <td align="center" valign="middle"><a href="services_servicewatchdog.php?act=del&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this service?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" title="<?=gettext("delete service");?>" alt="delete" /></a></td>
</tr>
</table>
</td></tr>
@@ -194,7 +194,7 @@ foreach ($a_pwservices as $thisservice):
<input name="del" type="image" src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" title="<?=gettext("delete selected services"); ?>" onclick="return confirm('<?=gettext("Do you really want to delete the selected services?");?>')" />
<?php endif; ?>
</td>
- <td><a href="services_procwatch_add.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="<?=gettext("add new service"); ?>" alt="add" /></a></td>
+ <td><a href="services_servicewatchdog_add.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="<?=gettext("add new service"); ?>" alt="add" /></a></td>
</tr>
</table>
</td>
diff --git a/config/procwatch/services_procwatch_add.php b/config/servicewatchdog/services_servicewatchdog_add.php
index 457a93a4..e5335540 100644
--- a/config/procwatch/services_procwatch_add.php
+++ b/config/servicewatchdog/services_servicewatchdog_add.php
@@ -1,6 +1,6 @@
<?php
/*
- services_procwatch_add.php
+ services_servicewatchdog_add.php
Copyright (C) 2013 Jim Pingle
All rights reserved.
@@ -30,20 +30,20 @@
*/
##|+PRIV
-##|*IDENT=page-services-procwatch-add
-##|*NAME=Services: Add ProcWatch Services
-##|*DESCR=Allow access to the 'Add ProcWatch Services' page.
-##|*MATCH=services_procwatch.php-add*
+##|*IDENT=page-services-servicewatchdog-add
+##|*NAME=Services: Add Service Watchdog Services
+##|*DESCR=Allow access to the 'Add Service Watchdog Services' page.
+##|*MATCH=services_servicewatchdog.php-add*
##|-PRIV
require("guiconfig.inc");
require_once("service-utils.inc");
-require_once("procwatch.inc");
+require_once("servicewatchdog.inc");
-if (!is_array($config['installedpackages']['procwatch']['item'])) {
- $config['installedpackages']['procwatch']['item'] = array();
+if (!is_array($config['installedpackages']['servicewatchdog']['item'])) {
+ $config['installedpackages']['servicewatchdog']['item'] = array();
}
-$a_pwservices = &$config['installedpackages']['procwatch']['item'];
+$a_pwservices = &$config['installedpackages']['servicewatchdog']['item'];
$a_pwservice_names = array();
foreach ($a_pwservices as $svc) {
$a_pwservice_names[] = $svc['name'];
@@ -62,16 +62,16 @@ if ($_POST) {
if (!$input_errors) {
$a_pwservices[] = $system_services[$_POST['svcid']];
- procwatch_cron_job();
+ servicewatchdog_cron_job();
write_config();
- header("Location: services_procwatch.php");
+ header("Location: services_servicewatchdog.php");
return;
}
}
$closehead = false;
-$pgtitle = array(gettext("Services"),gettext("ProcWatch"), gettext("Add"));
+$pgtitle = array(gettext("Services"),gettext("servicewatchdog"), gettext("Add"));
include("head.inc");
?>
@@ -83,7 +83,7 @@ include("head.inc");
<?php include("fbegin.inc"); ?>
<?php if ($input_errors) print_input_errors($input_errors); ?>
-<form action="services_procwatch_add.php" method="post" name="iform" id="iform">
+<form action="services_servicewatchdog_add.php" method="post" name="iform" id="iform">
<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="add monitored service">
<tr>
<td colspan="2" valign="top" class="listtopic"><?=gettext("Add Service Entry"); ?></td>
diff --git a/config/servicewatchdog/servicewatchdog.inc b/config/servicewatchdog/servicewatchdog.inc
new file mode 100644
index 00000000..d96a0f75
--- /dev/null
+++ b/config/servicewatchdog/servicewatchdog.inc
@@ -0,0 +1,39 @@
+<?php
+require_once("config.inc");
+require_once("services.inc");
+require_once("service-utils.inc");
+require_once("util.inc");
+
+function servicewatchdog_cron_job() {
+ global $config;
+ if (!is_array($config['installedpackages']['servicewatchdog']['item'])) {
+ $config['installedpackages']['servicewatchdog']['item'] = array();
+ }
+ $a_pwservices = &$config['installedpackages']['servicewatchdog']['item'];
+
+ if (count($a_pwservices) > 0) {
+ // Add the cron job if it doesn't exist.
+ install_cron_job("/usr/local/pkg/servicewatchdog_cron.php", true, "*/1");
+ } else {
+ // Remove the cron job
+ install_cron_job("/usr/local/pkg/servicewatchdog_cron.php", false, "*/1");
+ }
+}
+
+function servicewatchdog_check_services() {
+ global $config;
+ if (!is_array($config['installedpackages']['servicewatchdog']['item'])) {
+ $config['installedpackages']['servicewatchdog']['item'] = array();
+ }
+ $a_pwservices = &$config['installedpackages']['servicewatchdog']['item'];
+
+ foreach ($a_pwservices as $svc) {
+ if (!is_service_running($svc['name'])) {
+ $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})");
+ service_control_start($svc['name'], $svc);
+ }
+ }
+}
+
+?> \ No newline at end of file
diff --git a/config/procwatch/procwatch.xml b/config/servicewatchdog/servicewatchdog.xml
index 9db6d40d..70ecffe8 100644
--- a/config/procwatch/procwatch.xml
+++ b/config/servicewatchdog/servicewatchdog.xml
@@ -6,7 +6,7 @@
<![CDATA[
/* ========================================================================== */
/*
- procwatch.xml
+ servicewatchdog.xml
part of pfSense (http://www.pfSense.com)
Copyright (C) 2013 Jim Pingle
All rights reserved.
@@ -36,37 +36,37 @@
/* ========================================================================== */
]]>
</copyright>
- <description>ProcWatch</description>
+ <description>Service Watchdog</description>
<requirements>None</requirements>
<faq>Monitors for stopped services and restarts them.</faq>
- <name>ProcWatch</name>
+ <name>Service Watchdog</name>
<version>1.0</version>
- <title>Services: Procwatch</title>
- <include_file>/usr/local/pkg/procwatch.inc</include_file>
+ <title>Services: Service Watchdog</title>
+ <include_file>/usr/local/pkg/servicewatchdog.inc</include_file>
<menu>
- <name>ProcWatch</name>
+ <name>Service Watchdog</name>
<tooltiptext></tooltiptext>
<section>Services</section>
- <url>/services_procwatch.php</url>
+ <url>/services_servicewatchdog.php</url>
</menu>
<additional_files_needed>
<prefix>/usr/local/www/</prefix>
<chmod>644</chmod>
- <item>http://www.pfsense.com/packages/config/procwatch/services_procwatch.php</item>
+ <item>http://www.pfsense.com/packages/config/servicewatchdog/services_servicewatchdog.php</item>
</additional_files_needed>
<additional_files_needed>
<prefix>/usr/local/www/</prefix>
<chmod>644</chmod>
- <item>http://www.pfsense.com/packages/config/procwatch/services_procwatch_add.php</item>
+ <item>http://www.pfsense.com/packages/config/servicewatchdog/services_servicewatchdog_add.php</item>
</additional_files_needed>
<additional_files_needed>
<prefix>/usr/local/pkg/</prefix>
<chmod>755</chmod>
- <item>http://www.pfsense.com/packages/config/procwatch/procwatch_cron.php</item>
+ <item>http://www.pfsense.com/packages/config/servicewatchdog/servicewatchdog_cron.php</item>
</additional_files_needed>
<additional_files_needed>
<prefix>/usr/local/pkg/</prefix>
<chmod>644</chmod>
- <item>http://www.pfsense.com/packages/config/procwatch/procwatch.inc</item>
+ <item>http://www.pfsense.com/packages/config/servicewatchdog/servicewatchdog.inc</item>
</additional_files_needed>
</packagegui> \ No newline at end of file
diff --git a/config/servicewatchdog/servicewatchdog_cron.php b/config/servicewatchdog/servicewatchdog_cron.php
new file mode 100644
index 00000000..5031ab0b
--- /dev/null
+++ b/config/servicewatchdog/servicewatchdog_cron.php
@@ -0,0 +1,6 @@
+#!/usr/local/bin/php -f
+<?php
+require_once("servicewatchdog.inc");
+
+servicewatchdog_check_services();
+?> \ No newline at end of file
diff --git a/pkg_config.8.xml b/pkg_config.8.xml
index 6cf0d4b5..a6521070 100644
--- a/pkg_config.8.xml
+++ b/pkg_config.8.xml
@@ -1951,16 +1951,16 @@
<depends_on_package_pbi>sudo-1.8.6p8-i386.pbi</depends_on_package_pbi>
</package>
<package>
- <name>ProcWatch</name>
+ <name>Service Watchdog</name>
<descr>Monitors for stopped services and restarts them.</descr>
<maintainer>jimp@pfsense.org</maintainer>
<version>1.0</version>
<category>Services</category>
<status>BETA</status>
- <config_file>http://www.pfsense.com/packages/config/procwatch/procwatch.xml</config_file>
+ <config_file>http://www.pfsense.com/packages/config/servicewatchdog/servicewatchdog.xml</config_file>
<pkginfolink></pkginfolink>
<required_version>2.1</required_version>
- <configurationfile>procwatch.xml</configurationfile>
+ <configurationfile>servicewatchdog.xml</configurationfile>
</package>
</packages>
</pfsensepkgs>
diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64
index 9d390583..15ff2856 100644
--- a/pkg_config.8.xml.amd64
+++ b/pkg_config.8.xml.amd64
@@ -1938,16 +1938,16 @@
<depends_on_package_pbi>sudo-1.8.6p8-amd64.pbi</depends_on_package_pbi>
</package>
<package>
- <name>ProcWatch</name>
+ <name>Service Watchdog</name>
<descr>Monitors for stopped services and restarts them.</descr>
<maintainer>jimp@pfsense.org</maintainer>
<version>1.0</version>
<category>Services</category>
<status>BETA</status>
- <config_file>http://www.pfsense.com/packages/config/procwatch/procwatch.xml</config_file>
+ <config_file>http://www.pfsense.com/packages/config/servicewatchdog/servicewatchdog.xml</config_file>
<pkginfolink></pkginfolink>
<required_version>2.1</required_version>
- <configurationfile>procwatch.xml</configurationfile>
+ <configurationfile>servicewatchdog.xml</configurationfile>
</package>
</packages>
</pfsensepkgs>
href='#n1049'>1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293