From 269c6b9f69b5f780a0104154e6896e98eda41db2 Mon Sep 17 00:00:00 2001 From: Siddhu Date: Mon, 17 Jul 2017 23:17:32 +0530 Subject: [PATCH] Speedtest range set --- advanced/Scripts/webpage.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 2994034f..98e6757e 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -31,7 +31,9 @@ Options: -i, interface Specify dnsmasq's interface listening behavior Add '-h' for more info on interface usage -s, speedtest Set speedtest intevel , user 0 to disable Speedtests - use -sn to prevent logging to results list" + use -sn to prevent logging to results list + -sd Set speedtest display range" + exit 0 } @@ -335,8 +337,8 @@ RunSpeedtestNow(){ echo "" else cp /var/www/html/admin/scripts/pi-hole/speedtest/speedtest.db $speedtestdb + sleep 2 fi - sleep 2 if [ -f "$lockfile" ] then echo "Speedtest is already in progress, is something went wrong delete this file - "$lockfile @@ -389,6 +391,14 @@ CustomizeAdLists() { fi } +function UpdateSpeedTestRange(){ + if [[ "${args[2]}" =~ ^[0-9]+$ ]]; then + if [ "${args[2]}" -ge 0 -a "${args[2]}" -le 30 ]; then + change_setting "SPEEDTEST_CHART_DAYS" "${args[2]}" + fi + fi +} + SetPrivacyMode() { if [[ "${args[2]}" == "true" ]]; then change_setting "API_PRIVACY_MODE" "true" @@ -513,6 +523,7 @@ main() { "-t" | "teleporter" ) Teleporter;; "adlist" ) CustomizeAdLists;; "-s" | "speedtest" ) ChageSpeedTestSchedule;; + "-sd" ) UpdateSpeedTestRange;; "-sn" ) RunSpeedtestNow;; * ) helpFunc;; esac