diff --git a/scripts/pi-hole/js/restartdns.js b/scripts/pi-hole/js/restartdns.js new file mode 100644 index 0000000000..1cc3607407 --- /dev/null +++ b/scripts/pi-hole/js/restartdns.js @@ -0,0 +1,39 @@ +/* Pi-hole: A black hole for Internet advertisements + * (c) 2017 Pi-hole, LLC (https://pi-hole.net) + * Network-wide ad blocking via your own hardware. + * + * This file is copyright under the latest version of the EUPL. + * Please see LICENSE file for your rights under this license. */ + +var timeleft = 60; +var status = -1; +var reloadMsg = + "FTL was restarted: Reload FTL details."; +var warningMsg = "FTL was not able to reload after " + timeleft + " seconds."; +var counterMsg = "FTL is reoaling: "; + +var reloadTimer = setInterval(function () { + $.getJSON("api.php?dns-port", function (data) { + if ("FTLnotrunning" in data) { + return; + } + + status = data["dns-port"]; + }); + + if (timeleft <= 0 || status >= 0) { + clearInterval(reloadTimer); + if (status < 0) { + // FTL was not restarted in 60 seconds. Show warning message + document.getElementById("restart-countdown").innerHTML = warningMsg; + } else { + // FTL restartd. + document.getElementById("restart-countdown").innerHTML = reloadMsg; + } + } else { + document.getElementById("restart-countdown").innerHTML = + counterMsg + timeleft + " seconds remaining..."; + } + + timeleft -= 1; +}, 1000); diff --git a/scripts/pi-hole/php/func.php b/scripts/pi-hole/php/func.php index c451830638..6a7ed0f5af 100644 --- a/scripts/pi-hole/php/func.php +++ b/scripts/pi-hole/php/func.php @@ -691,12 +691,8 @@ function convertUnicodeToIDNA($unicode) } // Return PID of FTL (used in settings.php) -function pidofFTL($add_delay = false) +function pidofFTL() { - if ($add_delay) { - usleep(100000); - } - return shell_exec('pidof pihole-FTL'); } diff --git a/settings.php b/settings.php index 47de920f10..76a3677d85 100644 --- a/settings.php +++ b/settings.php @@ -237,10 +237,13 @@
- + $FTLversion = exec('/usr/bin/pihole-FTL version'); + ?> @@ -253,20 +256,19 @@ - + - + - + - +
Time FTL started:
User / Group: /
Total CPU utilization:%%
Memory utilization:%%
@@ -295,10 +297,20 @@
See also our DNS cache documentation. - + +
+ +
The FTL service is offline!
- +