From 1d30d667df0c29089c539c0bc10d1b67b46c2769 Mon Sep 17 00:00:00 2001 From: jim-p Date: Tue, 27 Aug 2013 21:48:51 -0400 Subject: Add ProcWatch, a little package to monitor services and restart them if they are stopped. Needs more testing, but the basics work. --- config/procwatch/services_procwatch.php | 211 ++++++++++++++++++++++++++++++++ 1 file changed, 211 insertions(+) create mode 100644 config/procwatch/services_procwatch.php (limited to 'config/procwatch/services_procwatch.php') diff --git a/config/procwatch/services_procwatch.php b/config/procwatch/services_procwatch.php new file mode 100644 index 00000000..c8a16b07 --- /dev/null +++ b/config/procwatch/services_procwatch.php @@ -0,0 +1,211 @@ + $pd) { + if (preg_match("/move_(\d+)_x/", $pn, $matches)) { + $movebtn = $matches[1]; + break; + } + } + /* move selected services before this service */ + if (isset($movebtn) && is_array($_POST['pwservices']) && count($_POST['pwservices'])) { + $a_pwservices_new = array(); + + /* copy all services < $movebtn and not selected */ + for ($i = 0; $i < $movebtn; $i++) { + if (!in_array($i, $_POST['pwservices'])) + $a_pwservices_new[] = $a_pwservices[$i]; + } + + /* copy all selected services */ + for ($i = 0; $i < count($a_pwservices); $i++) { + if ($i == $movebtn) + continue; + if (in_array($i, $_POST['pwservices'])) + $a_pwservices_new[] = $a_pwservices[$i]; + } + + /* copy $movebtn service */ + if ($movebtn < count($a_pwservices)) + $a_pwservices_new[] = $a_pwservices[$movebtn]; + + /* copy all services > $movebtn and not selected */ + for ($i = $movebtn+1; $i < count($a_pwservices); $i++) { + if (!in_array($i, $_POST['pwservices'])) + $a_pwservices_new[] = $a_pwservices[$i]; + } + $a_pwservices = $a_pwservices_new; + procwatch_cron_job(); + write_config(); + header("Location: services_procwatch.php"); + return; + } +} + +$closehead = false; +$pgtitle = array(gettext("Services"),gettext("ProcWatch")); +include("head.inc"); + +?> + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ +

+
  + + + + +
+ + " border="0" alt="delete" /> + + " onclick="return confirm('')" /> + + " alt="add" />
+
+ + + + + + + + + +
" height="17" type="image" width="17" border="0" />')">" alt="delete" />
+
+ + + + + + + + +
" border="0" alt="move" />" border="0" alt="move" />
+ + " border="0" alt="delete" /> + + " onclick="return confirm('')" /> + + " alt="add" />
+
+ +
+
+
+ + + -- cgit v1.2.3