From c064a6d69a8de215299505e0a12c205524025147 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sun, 15 Jan 2023 03:55:44 -0500 Subject: [PATCH 01/72] add type setting --- advanced/Scripts/webpage.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 61af4fec1a..bf72fd6641 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -502,7 +502,7 @@ ClearSpeedtestData() { cp /var/www/html/admin/scripts/pi-hole/speedtest/speedtest.db $speedtestdb } -ChageSpeedTestSchedule() { +ChangeSpeedTestSchedule() { if [[ "${args[2]}" =~ ^[0-9]+$ ]]; then if [ "${args[2]}" -ge 0 -a "${args[2]}" -le 24 ]; then addOrEditKeyValPair "${setupVars}" "SPEEDTESTSCHEDULE" "${args[2]}" @@ -536,7 +536,7 @@ SpeedtestMode() { } -function UpdateSpeedTestRange() { +UpdateSpeedTestRange() { if [[ "${args[2]}" =~ ^[0-9]+$ ]]; then if [ "${args[2]}" -ge 0 -a "${args[2]}" -le 30 ]; then addOrEditKeyValPair "${setupVars}" "SPEEDTEST_CHART_DAYS" "${args[2]}" @@ -544,6 +544,12 @@ function UpdateSpeedTestRange() { fi } +UpdateSpeedTestChartType() { + if [[ "${args[2]}" =~ ^(bar|line)$ ]]; then + addOrEditKeyValPair "${setupVars}" "SPEEDTEST_CHART_TYPE" "${args[2]}" + fi +} + SetCronTab() { # Remove OLD crontab -l >crontab.tmp || true @@ -912,12 +918,13 @@ main() { "audit" ) addAudit "$@";; "clearaudit" ) clearAudit;; "-l" | "privacylevel" ) SetPrivacyLevel;; - "-s" | "speedtest" ) ChageSpeedTestSchedule;; + "-s" | "speedtest" ) ChangeSpeedTestSchedule;; "-sd" ) UpdateSpeedTestRange;; "-sn" ) RunSpeedtestNow;; "-sm" ) SpeedtestMode;; "-sc" ) ClearSpeedtestData;; "-ss" ) SpeedtestServer;; + "-st" ) UpdateSpeedTestChartType;; "addcustomdns" ) AddCustomDNSAddress;; "removecustomdns" ) RemoveCustomDNSAddress;; "addcustomcname" ) AddCustomCNAMERecord;; From e7280b1df5d0907caedeb38f4d69aca2aece7a3e Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sun, 15 Jan 2023 05:15:28 -0500 Subject: [PATCH 02/72] properly? handle type --- advanced/Scripts/webpage.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index bf72fd6641..f1f53b72a4 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -547,6 +547,8 @@ UpdateSpeedTestRange() { UpdateSpeedTestChartType() { if [[ "${args[2]}" =~ ^(bar|line)$ ]]; then addOrEditKeyValPair "${setupVars}" "SPEEDTEST_CHART_TYPE" "${args[2]}" + else + addOrEditKeyValPair "${setupVars}" "SPEEDTEST_CHART_TYPE" "line" fi } From 155bbc736446696f4744cba3b8399ce9027fb251 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Thu, 19 Jan 2023 17:20:40 -0500 Subject: [PATCH 03/72] use systemd service --- advanced/Scripts/webpage.sh | 42 ++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index f1f53b72a4..056010d6ce 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -506,7 +506,7 @@ ChangeSpeedTestSchedule() { if [[ "${args[2]}" =~ ^[0-9]+$ ]]; then if [ "${args[2]}" -ge 0 -a "${args[2]}" -le 24 ]; then addOrEditKeyValPair "${setupVars}" "SPEEDTESTSCHEDULE" "${args[2]}" - SetCronTab ${args[2]} + SetService ${args[2]} fi fi } @@ -552,13 +552,14 @@ UpdateSpeedTestChartType() { fi } -SetCronTab() { +SetService() { # Remove OLD crontab -l >crontab.tmp || true + sed -i '/speedtest/d' crontab.tmp + crontab crontab.tmp && rm -f crontab.tmp if [[ "$1" == "0" ]]; then - sed -i '/speedtest/d' crontab.tmp - crontab crontab.tmp && rm -f crontab.tmp + systemctl disable --now pihole-speedtest.timer &> /dev/null else sed -i '/speedtest/d' crontab.tmp @@ -569,10 +570,35 @@ SetCronTab() { else speedtest_file="/var/www/html/admin/scripts/pi-hole/speedtest/speedtest.sh" fi - - newtab="0 */"${1}" * * * sudo \""${speedtest_file}"\" > /dev/null 2>&1" - printf '%s\n' "$newtab" >>crontab.tmp - crontab crontab.tmp && rm -f crontab.tmp + + # create a systemd timer to run the service + # create a systemd service to run the speedtest + cat > /etc/systemd/system/pihole-speedtest.service << EOL +[Unit] +Description=Pi-hole Speedtest +After=network.target + +[Service] +Type=oneshot +ExecStart=$speedtest_file + +[Install] +WantedBy=multi-user.target +EOL + + cat > /etc/systemd/system/pihole-speedtest.timer << EOL +[Unit] +Description=Pi-hole Speedtest Timer + +[Timer] +OnCalendar=*-*-* *:$1:00 +Persistent=true + +[Install] +WantedBy=timers.target +EOL + + systemctl enable --now pihole-speedtest.timer &> /dev/null fi } From 15609b7554ddf60845d137b86b819168fd866c9a Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Thu, 19 Jan 2023 18:40:29 -0500 Subject: [PATCH 04/72] forgot about reload --- advanced/Scripts/webpage.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 056010d6ce..cae4dbf8eb 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -591,14 +591,16 @@ EOL Description=Pi-hole Speedtest Timer [Timer] -OnCalendar=*-*-* *:$1:00 +OnCalendar=*-*-* $1:00:00 Persistent=true [Install] WantedBy=timers.target EOL - systemctl enable --now pihole-speedtest.timer &> /dev/null + systemctl daemon-reload + systemctl reenable pihole-speedtest.timer &> /dev/null + systemctl restart pihole-speedtest.timer fi } From 21cfa7bf237662e41b76876e3917c907d0e879e0 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Thu, 19 Jan 2023 19:52:38 -0500 Subject: [PATCH 05/72] are the files created? --- advanced/Scripts/webpage.sh | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index cae4dbf8eb..69b1d8994f 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -561,18 +561,12 @@ SetService() { if [[ "$1" == "0" ]]; then systemctl disable --now pihole-speedtest.timer &> /dev/null else - sed -i '/speedtest/d' crontab.tmp - mode=$(sed -n -e '/SPEEDTEST_MODE/ s/.*\= *//p' $setupVars) - + speedtest_file="/var/www/html/admin/scripts/pi-hole/speedtest/speedtest.sh" if [[ "$mode" =~ "official" ]]; then speedtest_file="/var/www/html/admin/scripts/pi-hole/speedtest/speedtest-official.sh" - else - speedtest_file="/var/www/html/admin/scripts/pi-hole/speedtest/speedtest.sh" fi - # create a systemd timer to run the service - # create a systemd service to run the speedtest cat > /etc/systemd/system/pihole-speedtest.service << EOL [Unit] Description=Pi-hole Speedtest From aeb38e6824483b2487d96ec979aef5c232506b70 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Thu, 19 Jan 2023 20:07:07 -0500 Subject: [PATCH 06/72] explicit shell moves redirection into su process --- advanced/Scripts/webpage.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 69b1d8994f..382808e185 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -56,6 +56,7 @@ Options: -sm Speedtest Mode -sc Clear speedtest data -ss Set custom server + -st Set default speedtest chart type (line, bar) -l, privacylevel Set privacy level (0 = lowest, 3 = highest) -t, teleporter Backup configuration as an archive -t, teleporter myname.tar.gz Backup configuration to archive with name myname.tar.gz as specified" @@ -567,7 +568,7 @@ SetService() { speedtest_file="/var/www/html/admin/scripts/pi-hole/speedtest/speedtest-official.sh" fi - cat > /etc/systemd/system/pihole-speedtest.service << EOL + sudo bash -c 'cat > /etc/systemd/system/pihole-speedtest.service << EOL [Unit] Description=Pi-hole Speedtest After=network.target @@ -578,9 +579,8 @@ ExecStart=$speedtest_file [Install] WantedBy=multi-user.target -EOL - - cat > /etc/systemd/system/pihole-speedtest.timer << EOL +EOL' + sudo bash -c 'cat > /etc/systemd/system/pihole-speedtest.timer << EOL [Unit] Description=Pi-hole Speedtest Timer @@ -590,7 +590,7 @@ Persistent=true [Install] WantedBy=timers.target -EOL +EOL' systemctl daemon-reload systemctl reenable pihole-speedtest.timer &> /dev/null From c80be75fcf253d0eab33fa6592b54ea7aacffd18 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Thu, 19 Jan 2023 20:17:04 -0500 Subject: [PATCH 07/72] variable inside string --- advanced/Scripts/webpage.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 382808e185..2f7034a93f 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -575,7 +575,7 @@ After=network.target [Service] Type=oneshot -ExecStart=$speedtest_file +ExecStart="$speedtest_file" [Install] WantedBy=multi-user.target @@ -585,7 +585,7 @@ EOL' Description=Pi-hole Speedtest Timer [Timer] -OnCalendar=*-*-* $1:00:00 +OnCalendar=*-*-* "$1":00:00 Persistent=true [Install] From 86ffe273fcd1709a759933240e11faf0abd021a6 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Thu, 19 Jan 2023 20:36:45 -0500 Subject: [PATCH 08/72] maybe escape --- advanced/Scripts/webpage.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 2f7034a93f..5489b63c76 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -568,7 +568,7 @@ SetService() { speedtest_file="/var/www/html/admin/scripts/pi-hole/speedtest/speedtest-official.sh" fi - sudo bash -c 'cat > /etc/systemd/system/pihole-speedtest.service << EOL + sudo bash -c 'cat > /etc/systemd/system/pihole-speedtest.service << \EOF [Unit] Description=Pi-hole Speedtest After=network.target @@ -579,8 +579,8 @@ ExecStart="$speedtest_file" [Install] WantedBy=multi-user.target -EOL' - sudo bash -c 'cat > /etc/systemd/system/pihole-speedtest.timer << EOL +EOF' + sudo bash -c 'cat > /etc/systemd/system/pihole-speedtest.timer << \EOF [Unit] Description=Pi-hole Speedtest Timer @@ -590,7 +590,7 @@ Persistent=true [Install] WantedBy=timers.target -EOL' +EOF' systemctl daemon-reload systemctl reenable pihole-speedtest.timer &> /dev/null From b888b6ac0e5da9460a7fb24ca416247775f87af5 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Thu, 19 Jan 2023 20:38:49 -0500 Subject: [PATCH 09/72] can i do this --- advanced/Scripts/webpage.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 5489b63c76..6c2f376d31 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -575,7 +575,7 @@ After=network.target [Service] Type=oneshot -ExecStart="$speedtest_file" +ExecStart='"$speedtest_file"' [Install] WantedBy=multi-user.target @@ -585,7 +585,7 @@ EOF' Description=Pi-hole Speedtest Timer [Timer] -OnCalendar=*-*-* "$1":00:00 +OnCalendar=*-*-* '"$1"':00:00 Persistent=true [Install] From 68b3a5824412ef24d9091866cfe54a7f75a480e5 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Thu, 19 Jan 2023 20:39:53 -0500 Subject: [PATCH 10/72] no escape? --- advanced/Scripts/webpage.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 6c2f376d31..1789272874 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -568,7 +568,7 @@ SetService() { speedtest_file="/var/www/html/admin/scripts/pi-hole/speedtest/speedtest-official.sh" fi - sudo bash -c 'cat > /etc/systemd/system/pihole-speedtest.service << \EOF + sudo bash -c 'cat > /etc/systemd/system/pihole-speedtest.service << EOF [Unit] Description=Pi-hole Speedtest After=network.target @@ -580,7 +580,7 @@ ExecStart='"$speedtest_file"' [Install] WantedBy=multi-user.target EOF' - sudo bash -c 'cat > /etc/systemd/system/pihole-speedtest.timer << \EOF + sudo bash -c 'cat > /etc/systemd/system/pihole-speedtest.timer << EOF [Unit] Description=Pi-hole Speedtest Timer From 01a4d8807b2e780302739f65f2f0466eee6c6bdc Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Thu, 19 Jan 2023 20:40:57 -0500 Subject: [PATCH 11/72] no "? --- advanced/Scripts/webpage.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 1789272874..0d0233591b 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -575,7 +575,7 @@ After=network.target [Service] Type=oneshot -ExecStart='"$speedtest_file"' +ExecStart='$speedtest_file' [Install] WantedBy=multi-user.target @@ -585,7 +585,7 @@ EOF' Description=Pi-hole Speedtest Timer [Timer] -OnCalendar=*-*-* '"$1"':00:00 +OnCalendar=*-*-* '$1':00:00 Persistent=true [Install] From b2e6bf0c68290486752826bb4f19318ecb09ac16 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Thu, 19 Jan 2023 20:45:14 -0500 Subject: [PATCH 12/72] there we go --- advanced/Scripts/webpage.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 0d0233591b..7299542e50 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -563,9 +563,9 @@ SetService() { systemctl disable --now pihole-speedtest.timer &> /dev/null else mode=$(sed -n -e '/SPEEDTEST_MODE/ s/.*\= *//p' $setupVars) - speedtest_file="/var/www/html/admin/scripts/pi-hole/speedtest/speedtest.sh" + speedtest_file='/var/www/html/admin/scripts/pi-hole/speedtest/speedtest.sh' if [[ "$mode" =~ "official" ]]; then - speedtest_file="/var/www/html/admin/scripts/pi-hole/speedtest/speedtest-official.sh" + speedtest_file='/var/www/html/admin/scripts/pi-hole/speedtest/speedtest-official.sh' fi sudo bash -c 'cat > /etc/systemd/system/pihole-speedtest.service << EOF From d739d4a6e6655792a1084586f27b4987e34b7985 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Thu, 19 Jan 2023 23:11:03 -0500 Subject: [PATCH 13/72] add support for update and uninstall functions --- advanced/Scripts/webpage.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 7299542e50..224f420c52 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -51,6 +51,8 @@ Options: -h, --help Show this help dialog -i, interface Specify dnsmasq's interface listening behavior -s, speedtest Set speedtest intevel , user 0 to disable Speedtests use -sn to prevent logging to results list + -up [un] Update Pi-hole and update or uninstall the Mod + -un [up] Uninstall Speedtest Mod and optionally update Pi-hole -sd Set speedtest display range -sn Run speedtest now -sm Speedtest Mode @@ -598,6 +600,13 @@ EOF' fi } +UpdateSpeedTest() { + curl -sSL https://github.com/arevindh/pihole-speedtest/raw/master/update.sh | bash ${args[2]} +} + +UninstallSpeedTest() { + curl -sSL https://github.com/arevindh/pihole-speedtest/raw/master/update.sh | bash ${args[2]} +} SetWebUITheme() { addOrEditKeyValPair "${setupVars}" "WEBTHEME" "${args[2]}" @@ -943,6 +952,8 @@ main() { "clearaudit" ) clearAudit;; "-l" | "privacylevel" ) SetPrivacyLevel;; "-s" | "speedtest" ) ChangeSpeedTestSchedule;; + "-up" ) UpdateSpeedTest;; + "-un" ) UninstallSpeedTest;; "-sd" ) UpdateSpeedTestRange;; "-sn" ) RunSpeedtestNow;; "-sm" ) SpeedtestMode;; From 7323c1f767d479a87693d74c3c1cdd6f57e1a154 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Fri, 20 Jan 2023 21:15:27 -0500 Subject: [PATCH 14/72] webpage.sh -> screen -> mod.sh --- advanced/Scripts/webpage.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 224f420c52..9378bdddee 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -51,8 +51,8 @@ Options: -h, --help Show this help dialog -i, interface Specify dnsmasq's interface listening behavior -s, speedtest Set speedtest intevel , user 0 to disable Speedtests use -sn to prevent logging to results list - -up [un] Update Pi-hole and update or uninstall the Mod - -un [up] Uninstall Speedtest Mod and optionally update Pi-hole + -up [un] Update Pi-hole and the Mod (or uninstall the Mod) + -un Uninstall Speedtest Mod without updating Pi-hole (requires original Pi-hole backup) -sd Set speedtest display range -sn Run speedtest now -sm Speedtest Mode @@ -601,11 +601,19 @@ EOF' } UpdateSpeedTest() { - curl -sSL https://github.com/arevindh/pihole-speedtest/raw/master/update.sh | bash ${args[2]} + if ! command -v screen &> /dev/null + then + apt-get install screen -y + fi + screen -S pimod -dm bash -c "curl -sSL https://github.com/arevindh/pihole-speedtest/raw/master/mod.sh | bash -s -- up ${args[2]}" } UninstallSpeedTest() { - curl -sSL https://github.com/arevindh/pihole-speedtest/raw/master/update.sh | bash ${args[2]} + if ! command -v screen &> /dev/null + then + apt-get install screen -y + fi + screen -S pimod -dm bash -c "curl -sSL https://github.com/arevindh/pihole-speedtest/raw/master/mod.sh | bash -s -- un" } SetWebUITheme() { From b3e1daf313b63317a3e7c42d995a2d20ce94e5c6 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Fri, 20 Jan 2023 21:17:35 -0500 Subject: [PATCH 15/72] org backup not needed --- advanced/Scripts/webpage.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 9378bdddee..84bea93fa7 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -52,7 +52,7 @@ Options: -i, interface Specify dnsmasq's interface listening behavior -s, speedtest Set speedtest intevel , user 0 to disable Speedtests use -sn to prevent logging to results list -up [un] Update Pi-hole and the Mod (or uninstall the Mod) - -un Uninstall Speedtest Mod without updating Pi-hole (requires original Pi-hole backup) + -un Uninstall Speedtest Mod without updating Pi-hole -sd Set speedtest display range -sn Run speedtest now -sm Speedtest Mode From 4c3dede0e328f23d8e72cd951e0937456d52b6f5 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Fri, 20 Jan 2023 23:01:16 -0500 Subject: [PATCH 16/72] do i need the timer? --- advanced/Scripts/webpage.sh | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 84bea93fa7..fb4e1d98b8 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -562,7 +562,7 @@ SetService() { crontab crontab.tmp && rm -f crontab.tmp if [[ "$1" == "0" ]]; then - systemctl disable --now pihole-speedtest.timer &> /dev/null + systemctl disable --now pihole-speedtest &> /dev/null else mode=$(sed -n -e '/SPEEDTEST_MODE/ s/.*\= *//p' $setupVars) speedtest_file='/var/www/html/admin/scripts/pi-hole/speedtest/speedtest.sh' @@ -576,27 +576,19 @@ Description=Pi-hole Speedtest After=network.target [Service] -Type=oneshot +User=root +CPUQuota=20% +Restart=always +RestartSec=$(($1*3600)) ExecStart='$speedtest_file' [Install] WantedBy=multi-user.target -EOF' - sudo bash -c 'cat > /etc/systemd/system/pihole-speedtest.timer << EOF -[Unit] -Description=Pi-hole Speedtest Timer - -[Timer] -OnCalendar=*-*-* '$1':00:00 -Persistent=true - -[Install] -WantedBy=timers.target EOF' systemctl daemon-reload - systemctl reenable pihole-speedtest.timer &> /dev/null - systemctl restart pihole-speedtest.timer + systemctl reenable pihole-speedtest + systemctl restart pihole-speedtest fi } From 367b31c8ab384d4b8667eb29f31fe7e37e9e8859 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Fri, 20 Jan 2023 23:04:05 -0500 Subject: [PATCH 17/72] forgot quotes --- advanced/Scripts/webpage.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index fb4e1d98b8..4b3a9903fa 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -579,7 +579,7 @@ After=network.target User=root CPUQuota=20% Restart=always -RestartSec=$(($1*3600)) +RestartSec='$(($1*3600))' ExecStart='$speedtest_file' [Install] From bb519efdd9eb065e70705ed572c72e143940859e Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Fri, 20 Jan 2023 23:11:36 -0500 Subject: [PATCH 18/72] yeah timer's better --- advanced/Scripts/webpage.sh | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 4b3a9903fa..3e32dba3dd 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -562,7 +562,7 @@ SetService() { crontab crontab.tmp && rm -f crontab.tmp if [[ "$1" == "0" ]]; then - systemctl disable --now pihole-speedtest &> /dev/null + systemctl disable --now pihole-speedtest.timer &> /dev/null else mode=$(sed -n -e '/SPEEDTEST_MODE/ s/.*\= *//p' $setupVars) speedtest_file='/var/www/html/admin/scripts/pi-hole/speedtest/speedtest.sh' @@ -578,17 +578,27 @@ After=network.target [Service] User=root CPUQuota=20% -Restart=always -RestartSec='$(($1*3600))' +Type=oneshot ExecStart='$speedtest_file' [Install] WantedBy=multi-user.target +EOF' + sudo bash -c 'cat > /etc/systemd/system/pihole-speedtest.timer << EOF +[Unit] +Description=Pi-hole Speedtest Timer + +[Timer] +OnCalendar=*-*-* '$1':00:00 +Persistent=true + +[Install] +WantedBy=timers.target EOF' systemctl daemon-reload - systemctl reenable pihole-speedtest - systemctl restart pihole-speedtest + systemctl reenable pihole-speedtest.timer &> /dev/null + systemctl restart pihole-speedtest.timer fi } From b8f6e1c8338612c9540547467138ef731690fe75 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sat, 21 Jan 2023 02:26:23 -0500 Subject: [PATCH 19/72] use my repo --- advanced/Scripts/webpage.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 3e32dba3dd..5a76898e0d 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -607,7 +607,7 @@ UpdateSpeedTest() { then apt-get install screen -y fi - screen -S pimod -dm bash -c "curl -sSL https://github.com/arevindh/pihole-speedtest/raw/master/mod.sh | bash -s -- up ${args[2]}" + screen -S pimod -dm bash -c "curl -sSL https://github.com/ipitio/pihole-speedtest/raw/master/mod.sh | bash -s -- up ${args[2]}" } UninstallSpeedTest() { @@ -615,7 +615,7 @@ UninstallSpeedTest() { then apt-get install screen -y fi - screen -S pimod -dm bash -c "curl -sSL https://github.com/arevindh/pihole-speedtest/raw/master/mod.sh | bash -s -- un" + screen -S pimod -dm bash -c "curl -sSL https://github.com/ipitio/pihole-speedtest/raw/master/mod.sh | bash -s -- un" } SetWebUITheme() { From af716ed1538e3f80de20e972f087f1e9e64970df Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sat, 21 Jan 2023 02:42:36 -0500 Subject: [PATCH 20/72] same thing --- advanced/Scripts/webpage.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 5a76898e0d..3a84b15ee7 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -607,7 +607,7 @@ UpdateSpeedTest() { then apt-get install screen -y fi - screen -S pimod -dm bash -c "curl -sSL https://github.com/ipitio/pihole-speedtest/raw/master/mod.sh | bash -s -- up ${args[2]}" + screen -S pimod -dm bash -c "curl -sSL https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | bash -s -- up ${args[2]}" } UninstallSpeedTest() { @@ -615,7 +615,7 @@ UninstallSpeedTest() { then apt-get install screen -y fi - screen -S pimod -dm bash -c "curl -sSL https://github.com/ipitio/pihole-speedtest/raw/master/mod.sh | bash -s -- un" + screen -S pimod -dm bash -c "curl -sSL https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | bash -s -- un" } SetWebUITheme() { From 73bbefbffef92efabdbea383c2256d2ca1b019df Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sat, 21 Jan 2023 02:46:03 -0500 Subject: [PATCH 21/72] is it the arg --- advanced/Scripts/webpage.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 3a84b15ee7..957bfe3f59 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -607,7 +607,7 @@ UpdateSpeedTest() { then apt-get install screen -y fi - screen -S pimod -dm bash -c "curl -sSL https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | bash -s -- up ${args[2]}" + screen -S pimod -dm bash -c "curl -sSL https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | bash -s -- up" } UninstallSpeedTest() { From a3e76c524223998e32a72cc51046082f24375714 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sat, 21 Jan 2023 02:48:20 -0500 Subject: [PATCH 22/72] let's put that back --- advanced/Scripts/webpage.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 957bfe3f59..3a84b15ee7 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -607,7 +607,7 @@ UpdateSpeedTest() { then apt-get install screen -y fi - screen -S pimod -dm bash -c "curl -sSL https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | bash -s -- up" + screen -S pimod -dm bash -c "curl -sSL https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | bash -s -- up ${args[2]}" } UninstallSpeedTest() { From 904467673de6ca15373e1082fa0557c3b5717bcc Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sat, 21 Jan 2023 03:41:43 -0500 Subject: [PATCH 23/72] tac tac? --- advanced/Scripts/webpage.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 3a84b15ee7..f4648aa8a5 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -607,7 +607,7 @@ UpdateSpeedTest() { then apt-get install screen -y fi - screen -S pimod -dm bash -c "curl -sSL https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | bash -s -- up ${args[2]}" + screen -S pimod -dm bash -c "curl -sSL https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | tac | tac | sudo bash -s -- up ${args[2]}" } UninstallSpeedTest() { @@ -615,7 +615,7 @@ UninstallSpeedTest() { then apt-get install screen -y fi - screen -S pimod -dm bash -c "curl -sSL https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | bash -s -- un" + screen -S pimod -dm bash -c "curl -sSL https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | tac | tac | sudo bash -s -- un" } SetWebUITheme() { From db199e30e7212ee7bcfbb10632347aed5fe418eb Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sat, 21 Jan 2023 06:33:17 -0500 Subject: [PATCH 24/72] use tmux --- advanced/Scripts/webpage.sh | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index f4648aa8a5..1c8f854107 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -603,19 +603,17 @@ EOF' } UpdateSpeedTest() { - if ! command -v screen &> /dev/null - then - apt-get install screen -y + if ! command -v tmux &> /dev/null; then + apt-get install tmux -y fi - screen -S pimod -dm bash -c "curl -sSL https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | tac | tac | sudo bash -s -- up ${args[2]}" + tmux new-session -d -s pimod "curl -sSL https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | tac | tac | bash -s -- up ${args[2]}" } UninstallSpeedTest() { - if ! command -v screen &> /dev/null - then - apt-get install screen -y + if ! command -v tmux &> /dev/null; then + apt-get install tmux -y fi - screen -S pimod -dm bash -c "curl -sSL https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | tac | tac | sudo bash -s -- un" + tmux new-session -d -s pimod "curl -sSL https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | tac | tac | bash -s -- un" } SetWebUITheme() { From 4aaebf165017a68117d3948e70d80abc340eea1f Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sat, 21 Jan 2023 06:51:54 -0500 Subject: [PATCH 25/72] stop tmux from exiting --- advanced/Scripts/webpage.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 1c8f854107..f590192c57 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -606,14 +606,16 @@ UpdateSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi - tmux new-session -d -s pimod "curl -sSL https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | tac | tac | bash -s -- up ${args[2]}" + tmux new-session -d -s pimod + tmux send-keys -t pimod "curl -sSL https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | tac | tac | bash -s -- up ${args[2]}" Enter } UninstallSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi - tmux new-session -d -s pimod "curl -sSL https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | tac | tac | bash -s -- un" + tmux new-session -d -s pimod + tmux send-keys -t pimod "curl -sSL https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | tac | tac | bash -s -- un" Enter } SetWebUITheme() { From acb0762beefe59cad85e26ed8153479cab0e3dad Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sat, 21 Jan 2023 07:04:40 -0500 Subject: [PATCH 26/72] switch to tmux --- advanced/Scripts/webpage.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 3e32dba3dd..52b1ea75c3 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -603,19 +603,19 @@ EOF' } UpdateSpeedTest() { - if ! command -v screen &> /dev/null - then - apt-get install screen -y + if ! command -v tmux &> /dev/null; then + apt-get install tmux -y fi - screen -S pimod -dm bash -c "curl -sSL https://github.com/arevindh/pihole-speedtest/raw/master/mod.sh | bash -s -- up ${args[2]}" + tmux new-session -d -s pimod + tmux send-keys -t pimod "curl -sSL https://github.com/arevindh/pihole-speedtest/raw/master/mod.sh | tac | tac | bash -s -- up ${args[2]}" Enter } UninstallSpeedTest() { - if ! command -v screen &> /dev/null - then - apt-get install screen -y + if ! command -v tmux &> /dev/null; then + apt-get install tmux -y fi - screen -S pimod -dm bash -c "curl -sSL https://github.com/arevindh/pihole-speedtest/raw/master/mod.sh | bash -s -- un" + tmux new-session -d -s pimod + tmux send-keys -t pimod "curl -sSL https://github.com/arevindh/pihole-speedtest/raw/master/mod.sh | tac | tac | bash -s -- un" Enter } SetWebUITheme() { From 673e8d684869a27af33f1d9a5a0ad4aa0255cdec Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sat, 21 Jan 2023 07:26:34 -0500 Subject: [PATCH 27/72] remove session if exists --- advanced/Scripts/webpage.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 52b1ea75c3..58f550d025 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -606,6 +606,7 @@ UpdateSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi + tmux kill-session -t pimod &> /dev/null tmux new-session -d -s pimod tmux send-keys -t pimod "curl -sSL https://github.com/arevindh/pihole-speedtest/raw/master/mod.sh | tac | tac | bash -s -- up ${args[2]}" Enter } @@ -614,6 +615,7 @@ UninstallSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi + tmux kill-session -t pimod &> /dev/null tmux new-session -d -s pimod tmux send-keys -t pimod "curl -sSL https://github.com/arevindh/pihole-speedtest/raw/master/mod.sh | tac | tac | bash -s -- un" Enter } From 00e36073b3d89ab5a6b48db36fc06d966330519c Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sat, 21 Jan 2023 07:26:55 -0500 Subject: [PATCH 28/72] remove session if exists --- advanced/Scripts/webpage.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index f590192c57..1857f086ab 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -606,6 +606,7 @@ UpdateSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi + tmux kill-session -t pimod &> /dev/null tmux new-session -d -s pimod tmux send-keys -t pimod "curl -sSL https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | tac | tac | bash -s -- up ${args[2]}" Enter } @@ -614,6 +615,7 @@ UninstallSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi + tmux kill-session -t pimod &> /dev/null tmux new-session -d -s pimod tmux send-keys -t pimod "curl -sSL https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | tac | tac | bash -s -- un" Enter } From b381bed6fd2d0536f3b481813d8cc343bda7a657 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sat, 21 Jan 2023 08:04:01 -0500 Subject: [PATCH 29/72] curl can manage buffer by itself like a big it --- advanced/Scripts/webpage.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 1857f086ab..c1dd00becf 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -608,7 +608,7 @@ UpdateSpeedTest() { fi tmux kill-session -t pimod &> /dev/null tmux new-session -d -s pimod - tmux send-keys -t pimod "curl -sSL https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | tac | tac | bash -s -- up ${args[2]}" Enter + tmux send-keys -t pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | bash -s -- up ${args[2]}" Enter } UninstallSpeedTest() { @@ -617,7 +617,7 @@ UninstallSpeedTest() { fi tmux kill-session -t pimod &> /dev/null tmux new-session -d -s pimod - tmux send-keys -t pimod "curl -sSL https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | tac | tac | bash -s -- un" Enter + tmux send-keys -t pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | bash -s -- un" Enter } SetWebUITheme() { From 24cdfa953b53bb7521a730703a4b39e7b3fe6ad7 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sat, 21 Jan 2023 08:05:05 -0500 Subject: [PATCH 30/72] change to how buffer is managed --- advanced/Scripts/webpage.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 58f550d025..6ffe543e5d 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -608,7 +608,7 @@ UpdateSpeedTest() { fi tmux kill-session -t pimod &> /dev/null tmux new-session -d -s pimod - tmux send-keys -t pimod "curl -sSL https://github.com/arevindh/pihole-speedtest/raw/master/mod.sh | tac | tac | bash -s -- up ${args[2]}" Enter + tmux send-keys -t pimod "curl -sSLN https://github.com/arevindh/pihole-speedtest/raw/master/mod.sh | bash -s -- up ${args[2]}" Enter } UninstallSpeedTest() { @@ -617,7 +617,7 @@ UninstallSpeedTest() { fi tmux kill-session -t pimod &> /dev/null tmux new-session -d -s pimod - tmux send-keys -t pimod "curl -sSL https://github.com/arevindh/pihole-speedtest/raw/master/mod.sh | tac | tac | bash -s -- un" Enter + tmux send-keys -t pimod "curl -sSLN https://github.com/arevindh/pihole-speedtest/raw/master/mod.sh | bash -s -- un" Enter } SetWebUITheme() { From 91b1fefc9e42feee87c8c327a429b6a95e1c75b1 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sat, 21 Jan 2023 11:06:50 -0500 Subject: [PATCH 31/72] maybe it was better this way --- advanced/Scripts/webpage.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index c1dd00becf..1857f086ab 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -608,7 +608,7 @@ UpdateSpeedTest() { fi tmux kill-session -t pimod &> /dev/null tmux new-session -d -s pimod - tmux send-keys -t pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | bash -s -- up ${args[2]}" Enter + tmux send-keys -t pimod "curl -sSL https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | tac | tac | bash -s -- up ${args[2]}" Enter } UninstallSpeedTest() { @@ -617,7 +617,7 @@ UninstallSpeedTest() { fi tmux kill-session -t pimod &> /dev/null tmux new-session -d -s pimod - tmux send-keys -t pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | bash -s -- un" Enter + tmux send-keys -t pimod "curl -sSL https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | tac | tac | bash -s -- un" Enter } SetWebUITheme() { From 190efa02c79cc4b3a43dd1cd4cfae398530aa34f Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sat, 21 Jan 2023 11:14:19 -0500 Subject: [PATCH 32/72] undo --- advanced/Scripts/webpage.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 1857f086ab..e7a269aac3 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -608,7 +608,7 @@ UpdateSpeedTest() { fi tmux kill-session -t pimod &> /dev/null tmux new-session -d -s pimod - tmux send-keys -t pimod "curl -sSL https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | tac | tac | bash -s -- up ${args[2]}" Enter + tmux send-keys -t pimod "curl -sSL https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | bash -s -- up ${args[2]}" Enter } UninstallSpeedTest() { @@ -617,7 +617,7 @@ UninstallSpeedTest() { fi tmux kill-session -t pimod &> /dev/null tmux new-session -d -s pimod - tmux send-keys -t pimod "curl -sSL https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | tac | tac | bash -s -- un" Enter + tmux send-keys -t pimod "curl -sSL https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | bash -s -- un" Enter } SetWebUITheme() { From 31a0a716d37ab24cc1dcad5e72ee6a54f58d0439 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sat, 21 Jan 2023 11:14:44 -0500 Subject: [PATCH 33/72] actually undo --- advanced/Scripts/webpage.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index e7a269aac3..c1dd00becf 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -608,7 +608,7 @@ UpdateSpeedTest() { fi tmux kill-session -t pimod &> /dev/null tmux new-session -d -s pimod - tmux send-keys -t pimod "curl -sSL https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | bash -s -- up ${args[2]}" Enter + tmux send-keys -t pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | bash -s -- up ${args[2]}" Enter } UninstallSpeedTest() { @@ -617,7 +617,7 @@ UninstallSpeedTest() { fi tmux kill-session -t pimod &> /dev/null tmux new-session -d -s pimod - tmux send-keys -t pimod "curl -sSL https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | bash -s -- un" Enter + tmux send-keys -t pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | bash -s -- un" Enter } SetWebUITheme() { From 8958fe0394595d4fec66b634a04d82582a293503 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sat, 21 Jan 2023 11:32:36 -0500 Subject: [PATCH 34/72] dont kill --- advanced/Scripts/webpage.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index c1dd00becf..912f3ab2d4 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -606,7 +606,6 @@ UpdateSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi - tmux kill-session -t pimod &> /dev/null tmux new-session -d -s pimod tmux send-keys -t pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | bash -s -- up ${args[2]}" Enter } @@ -615,7 +614,6 @@ UninstallSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi - tmux kill-session -t pimod &> /dev/null tmux new-session -d -s pimod tmux send-keys -t pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | bash -s -- un" Enter } From 5c04432fd0af070431ebc278be605094e72b23b4 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sat, 21 Jan 2023 11:50:49 -0500 Subject: [PATCH 35/72] is it the buffer --- advanced/Scripts/webpage.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 912f3ab2d4..25c0e7bda9 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -606,14 +606,16 @@ UpdateSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi + tmux kill-session -t pimod &> /dev/null tmux new-session -d -s pimod - tmux send-keys -t pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | bash -s -- up ${args[2]}" Enter + tmux send-keys -t pimod "curl -sSL https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | tac | tac | bash -s -- up ${args[2]}" Enter } UninstallSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi + tmux kill-session -t pimod &> /dev/null tmux new-session -d -s pimod tmux send-keys -t pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | bash -s -- un" Enter } From 9b5bc4c839b7132103319bc048803563510c7be9 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sat, 21 Jan 2023 12:06:31 -0500 Subject: [PATCH 36/72] is it this --- advanced/Scripts/webpage.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 25c0e7bda9..49c5786c82 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -607,8 +607,7 @@ UpdateSpeedTest() { apt-get install tmux -y fi tmux kill-session -t pimod &> /dev/null - tmux new-session -d -s pimod - tmux send-keys -t pimod "curl -sSL https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | tac | tac | bash -s -- up ${args[2]}" Enter + tmux new-session -d -s pimod "curl -sSL https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | tac | tac | bash -s -- up ${args[2]}" } UninstallSpeedTest() { @@ -616,8 +615,7 @@ UninstallSpeedTest() { apt-get install tmux -y fi tmux kill-session -t pimod &> /dev/null - tmux new-session -d -s pimod - tmux send-keys -t pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | bash -s -- un" Enter + tmux new-session -d -s pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | bash -s -- un" } SetWebUITheme() { From d2bdd35b672b5071e8d905dadd8113b65df04f1a Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sat, 21 Jan 2023 12:28:34 -0500 Subject: [PATCH 37/72] forgot sudo --- advanced/Scripts/webpage.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 49c5786c82..d0f771984c 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -607,7 +607,8 @@ UpdateSpeedTest() { apt-get install tmux -y fi tmux kill-session -t pimod &> /dev/null - tmux new-session -d -s pimod "curl -sSL https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | tac | tac | bash -s -- up ${args[2]}" + tmux new-session -d -s pimod + tmux send-keys -t pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- up ${args[2]}" Enter } UninstallSpeedTest() { @@ -615,7 +616,8 @@ UninstallSpeedTest() { apt-get install tmux -y fi tmux kill-session -t pimod &> /dev/null - tmux new-session -d -s pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | bash -s -- un" + tmux new-session -d -s pimod + tmux send-keys -t pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- un" Enter } SetWebUITheme() { From 4103b91453a0f8692bba33b2e87d75e639044bd9 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sat, 21 Jan 2023 12:59:11 -0500 Subject: [PATCH 38/72] add logging --- advanced/Scripts/webpage.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index d0f771984c..d26bcfc564 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -617,7 +617,9 @@ UninstallSpeedTest() { fi tmux kill-session -t pimod &> /dev/null tmux new-session -d -s pimod + echo "Uninstalling Pi-hole Speedtest" > /tmp/pimod.log tmux send-keys -t pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- un" Enter + echo "Sent command" >> /tmp/pimod.log } SetWebUITheme() { From cdb463e0a2c43bf955e8cdfaf72fdcd9682f5366 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sat, 21 Jan 2023 14:51:10 -0500 Subject: [PATCH 39/72] undo log --- advanced/Scripts/webpage.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index d26bcfc564..d0f771984c 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -617,9 +617,7 @@ UninstallSpeedTest() { fi tmux kill-session -t pimod &> /dev/null tmux new-session -d -s pimod - echo "Uninstalling Pi-hole Speedtest" > /tmp/pimod.log tmux send-keys -t pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- un" Enter - echo "Sent command" >> /tmp/pimod.log } SetWebUITheme() { From 62d9598826d32e0526da6c7fe61a5fe9373e9656 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sat, 21 Jan 2023 15:53:37 -0500 Subject: [PATCH 40/72] at this point ill try anything --- advanced/Scripts/webpage.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index d0f771984c..8de0db13d9 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -606,7 +606,7 @@ UpdateSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi - tmux kill-session -t pimod &> /dev/null + tmux kill-session -t pimod tmux new-session -d -s pimod tmux send-keys -t pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- up ${args[2]}" Enter } @@ -615,7 +615,7 @@ UninstallSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi - tmux kill-session -t pimod &> /dev/null + tmux kill-session -t pimod tmux new-session -d -s pimod tmux send-keys -t pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- un" Enter } From 670190619421d900c3de68435816f8c662593c4e Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sun, 22 Jan 2023 02:14:04 -0500 Subject: [PATCH 41/72] put it back --- advanced/Scripts/webpage.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 8de0db13d9..d0f771984c 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -606,7 +606,7 @@ UpdateSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi - tmux kill-session -t pimod + tmux kill-session -t pimod &> /dev/null tmux new-session -d -s pimod tmux send-keys -t pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- up ${args[2]}" Enter } @@ -615,7 +615,7 @@ UninstallSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi - tmux kill-session -t pimod + tmux kill-session -t pimod &> /dev/null tmux new-session -d -s pimod tmux send-keys -t pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- un" Enter } From bbf58945092302b817b28bcc81befa3534e2d09a Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sun, 22 Jan 2023 04:14:30 -0500 Subject: [PATCH 42/72] log preserves output --- advanced/Scripts/webpage.sh | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index d0f771984c..60a2f555a6 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -606,18 +606,14 @@ UpdateSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi - tmux kill-session -t pimod &> /dev/null - tmux new-session -d -s pimod - tmux send-keys -t pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- up ${args[2]}" Enter + tmux new-session -d -s pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- up ${args[2]}" Enter } UninstallSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi - tmux kill-session -t pimod &> /dev/null - tmux new-session -d -s pimod - tmux send-keys -t pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- un" Enter + tmux new-session -d -s pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- un" Enter } SetWebUITheme() { From 7f26606d8d23b49d30951d77bc05cd7b1079520c Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sun, 22 Jan 2023 04:20:23 -0500 Subject: [PATCH 43/72] words --- advanced/Scripts/webpage.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 60a2f555a6..1a639e26de 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -606,14 +606,14 @@ UpdateSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi - tmux new-session -d -s pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- up ${args[2]}" Enter + tmux new-session -d -s pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- up ${args[2]}" } UninstallSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi - tmux new-session -d -s pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- un" Enter + tmux new-session -d -s pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- un" } SetWebUITheme() { From 9c9c96ef31d952f12b577a37d9273a85f73119d7 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sun, 22 Jan 2023 06:13:52 -0500 Subject: [PATCH 44/72] save log in favor of a persistent session --- advanced/Scripts/webpage.sh | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 6ffe543e5d..b122290e35 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -51,8 +51,8 @@ Options: -h, --help Show this help dialog -i, interface Specify dnsmasq's interface listening behavior -s, speedtest Set speedtest intevel , user 0 to disable Speedtests use -sn to prevent logging to results list - -up [un] Update Pi-hole and the Mod (or uninstall the Mod) - -un Uninstall Speedtest Mod without updating Pi-hole + -up [un] [db] Update Pi-hole and (or uninstall) the Mod (and flush the database) + -un [db] Uninstall Speedtest Mod without updating Pi-hole (and delete the database) -sd Set speedtest display range -sn Run speedtest now -sm Speedtest Mode @@ -606,18 +606,14 @@ UpdateSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi - tmux kill-session -t pimod &> /dev/null - tmux new-session -d -s pimod - tmux send-keys -t pimod "curl -sSLN https://github.com/arevindh/pihole-speedtest/raw/master/mod.sh | bash -s -- up ${args[2]}" Enter + tmux new-session -d -s pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- up ${args[2]}" } UninstallSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi - tmux kill-session -t pimod &> /dev/null - tmux new-session -d -s pimod - tmux send-keys -t pimod "curl -sSLN https://github.com/arevindh/pihole-speedtest/raw/master/mod.sh | bash -s -- un" Enter + tmux new-session -d -s pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- un" } SetWebUITheme() { From e82d5cbf80fe4f9ca20c24746dae795a74d1f0ca Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sun, 22 Jan 2023 06:14:53 -0500 Subject: [PATCH 45/72] words --- advanced/Scripts/webpage.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 1a639e26de..b122290e35 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -51,8 +51,8 @@ Options: -h, --help Show this help dialog -i, interface Specify dnsmasq's interface listening behavior -s, speedtest Set speedtest intevel , user 0 to disable Speedtests use -sn to prevent logging to results list - -up [un] Update Pi-hole and the Mod (or uninstall the Mod) - -un Uninstall Speedtest Mod without updating Pi-hole + -up [un] [db] Update Pi-hole and (or uninstall) the Mod (and flush the database) + -un [db] Uninstall Speedtest Mod without updating Pi-hole (and delete the database) -sd Set speedtest display range -sn Run speedtest now -sm Speedtest Mode From 45090eb308b288465e0a0527c46e82c953f6e8f3 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sun, 22 Jan 2023 09:20:17 -0500 Subject: [PATCH 46/72] account for db --- advanced/Scripts/webpage.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index b122290e35..019a1c3a62 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -50,9 +50,10 @@ Options: -k, kelvin Set Kelvin as preferred temperature unit -h, --help Show this help dialog -i, interface Specify dnsmasq's interface listening behavior - -s, speedtest Set speedtest intevel , user 0 to disable Speedtests use -sn to prevent logging to results list - -up [un] [db] Update Pi-hole and (or uninstall) the Mod (and flush the database) + -s, speedtest Set speedtest interval, user 0 to disable Speedtests, use -sn to prevent logging to results list + -up [un] [db] Update Pi-hole (and | but uninstall) the Mod (and flush the database) -un [db] Uninstall Speedtest Mod without updating Pi-hole (and delete the database) + -db Flush the database -sd Set speedtest display range -sn Run speedtest now -sm Speedtest Mode @@ -962,6 +963,7 @@ main() { "-s" | "speedtest" ) ChangeSpeedTestSchedule;; "-up" ) UpdateSpeedTest;; "-un" ) UninstallSpeedTest;; + "-db" ) ClearSpeedtestData;; "-sd" ) UpdateSpeedTestRange;; "-sn" ) RunSpeedtestNow;; "-sm" ) SpeedtestMode;; From 562c44aaba241f05f20b3627a9aac84b6424d7f6 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sun, 22 Jan 2023 12:56:17 -0500 Subject: [PATCH 47/72] persist tmux again --- advanced/Scripts/webpage.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 019a1c3a62..0ca4e146ed 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -607,14 +607,18 @@ UpdateSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi - tmux new-session -d -s pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- up ${args[2]}" + tmux kill-session -t pimod &> /dev/null + tmux new-session -d -s pimod + tmux send-keys -t pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- up ${args[2]}" } UninstallSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi - tmux new-session -d -s pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- un" + tmux kill-session -t pimod &> /dev/null + tmux new-session -d -s pimod + tmux send-keys -t pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- un" } SetWebUITheme() { From 215a78ab75c411c5d17d6171ec3bbc8b993abee3 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sun, 22 Jan 2023 13:03:00 -0500 Subject: [PATCH 48/72] word --- advanced/Scripts/webpage.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 0ca4e146ed..f240dc2a78 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -609,7 +609,7 @@ UpdateSpeedTest() { fi tmux kill-session -t pimod &> /dev/null tmux new-session -d -s pimod - tmux send-keys -t pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- up ${args[2]}" + tmux send-keys -t pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- up ${args[2]}" Enter } UninstallSpeedTest() { @@ -618,7 +618,7 @@ UninstallSpeedTest() { fi tmux kill-session -t pimod &> /dev/null tmux new-session -d -s pimod - tmux send-keys -t pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- un" + tmux send-keys -t pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- un" Enter } SetWebUITheme() { From a6be22f58975038673bb09566c7fbd9ad6751e50 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sun, 22 Jan 2023 13:05:13 -0500 Subject: [PATCH 49/72] support the other options --- advanced/Scripts/webpage.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index f240dc2a78..adddb860f0 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -609,7 +609,7 @@ UpdateSpeedTest() { fi tmux kill-session -t pimod &> /dev/null tmux new-session -d -s pimod - tmux send-keys -t pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- up ${args[2]}" Enter + tmux send-keys -t pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- up ${args[2]} ${args[3]}" Enter } UninstallSpeedTest() { @@ -618,7 +618,7 @@ UninstallSpeedTest() { fi tmux kill-session -t pimod &> /dev/null tmux new-session -d -s pimod - tmux send-keys -t pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- un" Enter + tmux send-keys -t pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- un ${args[2]}" Enter } SetWebUITheme() { From 1daa0dd0c64f460a50524c72d01f022f2c7fc562 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sun, 22 Jan 2023 13:15:25 -0500 Subject: [PATCH 50/72] undo persist again --- advanced/Scripts/webpage.sh | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index adddb860f0..019a1c3a62 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -607,18 +607,14 @@ UpdateSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi - tmux kill-session -t pimod &> /dev/null - tmux new-session -d -s pimod - tmux send-keys -t pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- up ${args[2]} ${args[3]}" Enter + tmux new-session -d -s pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- up ${args[2]}" } UninstallSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi - tmux kill-session -t pimod &> /dev/null - tmux new-session -d -s pimod - tmux send-keys -t pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- un ${args[2]}" Enter + tmux new-session -d -s pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- un" } SetWebUITheme() { From 9ec89f9e2e7e36b99468520b0a588c94aadb1095 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sun, 22 Jan 2023 13:18:19 -0500 Subject: [PATCH 51/72] redo --- advanced/Scripts/webpage.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index b122290e35..3b3d2dbe2d 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -50,9 +50,10 @@ Options: -k, kelvin Set Kelvin as preferred temperature unit -h, --help Show this help dialog -i, interface Specify dnsmasq's interface listening behavior - -s, speedtest Set speedtest intevel , user 0 to disable Speedtests use -sn to prevent logging to results list - -up [un] [db] Update Pi-hole and (or uninstall) the Mod (and flush the database) + -s, speedtest Set speedtest interval, user 0 to disable Speedtests, use -sn to prevent logging to results list + -up [un] [db] Update Pi-hole (and | but uninstall) the Mod (and flush the database) -un [db] Uninstall Speedtest Mod without updating Pi-hole (and delete the database) + -db Flush the database -sd Set speedtest display range -sn Run speedtest now -sm Speedtest Mode @@ -606,14 +607,18 @@ UpdateSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi - tmux new-session -d -s pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- up ${args[2]}" + tmux kill-session -t pimod &> /dev/null + tmux new-session -d -s pimod + tmux send-keys -t pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- up ${args[2]} ${args[3]}" Enter } UninstallSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi - tmux new-session -d -s pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- un" + tmux kill-session -t pimod &> /dev/null + tmux new-session -d -s pimod + tmux send-keys -t pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- un ${args[2]}" Enter } SetWebUITheme() { @@ -962,6 +967,7 @@ main() { "-s" | "speedtest" ) ChangeSpeedTestSchedule;; "-up" ) UpdateSpeedTest;; "-un" ) UninstallSpeedTest;; + "-db" ) ClearSpeedtestData;; "-sd" ) UpdateSpeedTestRange;; "-sn" ) RunSpeedtestNow;; "-sm" ) SpeedtestMode;; From ff9d1ed4ac1f7a1ca77d4f8143c7e0aea1bd6e70 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sun, 22 Jan 2023 13:18:48 -0500 Subject: [PATCH 52/72] redo --- advanced/Scripts/webpage.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 019a1c3a62..3b3d2dbe2d 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -607,14 +607,18 @@ UpdateSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi - tmux new-session -d -s pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- up ${args[2]}" + tmux kill-session -t pimod &> /dev/null + tmux new-session -d -s pimod + tmux send-keys -t pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- up ${args[2]} ${args[3]}" Enter } UninstallSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi - tmux new-session -d -s pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- un" + tmux kill-session -t pimod &> /dev/null + tmux new-session -d -s pimod + tmux send-keys -t pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- un ${args[2]}" Enter } SetWebUITheme() { From 27aa3c7685113a63643bd2ce609a180ba8cb0baf Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sun, 22 Jan 2023 13:28:25 -0500 Subject: [PATCH 53/72] undo --- advanced/Scripts/webpage.sh | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 3b3d2dbe2d..019a1c3a62 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -607,18 +607,14 @@ UpdateSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi - tmux kill-session -t pimod &> /dev/null - tmux new-session -d -s pimod - tmux send-keys -t pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- up ${args[2]} ${args[3]}" Enter + tmux new-session -d -s pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- up ${args[2]}" } UninstallSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi - tmux kill-session -t pimod &> /dev/null - tmux new-session -d -s pimod - tmux send-keys -t pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- un ${args[2]}" Enter + tmux new-session -d -s pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- un" } SetWebUITheme() { From 7bb014a3ebc883626450af127038c2ef24a5a2ab Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sun, 22 Jan 2023 13:28:48 -0500 Subject: [PATCH 54/72] what --- advanced/Scripts/webpage.sh | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 3b3d2dbe2d..019a1c3a62 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -607,18 +607,14 @@ UpdateSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi - tmux kill-session -t pimod &> /dev/null - tmux new-session -d -s pimod - tmux send-keys -t pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- up ${args[2]} ${args[3]}" Enter + tmux new-session -d -s pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- up ${args[2]}" } UninstallSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi - tmux kill-session -t pimod &> /dev/null - tmux new-session -d -s pimod - tmux send-keys -t pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- un ${args[2]}" Enter + tmux new-session -d -s pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- un" } SetWebUITheme() { From 29883412dda2936b0540432af48a1e942c9b53ea Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sun, 22 Jan 2023 13:35:27 -0500 Subject: [PATCH 55/72] forgot that --- advanced/Scripts/webpage.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 019a1c3a62..1a34d1099f 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -607,14 +607,14 @@ UpdateSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi - tmux new-session -d -s pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- up ${args[2]}" + tmux new-session -d -s pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- up ${args[2]} ${args[3]}" } UninstallSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi - tmux new-session -d -s pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- un" + tmux new-session -d -s pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- un ${args[2]}" } SetWebUITheme() { From ec38715c1890eca4c3484f5477690928902913de Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sun, 22 Jan 2023 13:36:02 -0500 Subject: [PATCH 56/72] forgot those --- advanced/Scripts/webpage.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 019a1c3a62..1a34d1099f 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -607,14 +607,14 @@ UpdateSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi - tmux new-session -d -s pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- up ${args[2]}" + tmux new-session -d -s pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- up ${args[2]} ${args[3]}" } UninstallSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi - tmux new-session -d -s pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- un" + tmux new-session -d -s pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- un ${args[2]}" } SetWebUITheme() { From 6a6dbf1c52106a8c0e32cbc7128ee93e42cfcead Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sun, 22 Jan 2023 13:39:24 -0500 Subject: [PATCH 57/72] change repos --- advanced/Scripts/webpage.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 019a1c3a62..0aa211cf8f 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -607,14 +607,14 @@ UpdateSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi - tmux new-session -d -s pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- up ${args[2]}" + tmux new-session -d -s pimod "curl -sSLN https://github.com/arevindh/pihole-speedtest/raw/master/mod.sh | sudo bash -s -- up ${args[2]} ${args[3]}" } UninstallSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi - tmux new-session -d -s pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- un" + tmux new-session -d -s pimod "curl -sSLN https://github.com/arevindh/pihole-speedtest/raw/master/mod.sh | sudo bash -s -- un ${args[2]}" } SetWebUITheme() { From 24c6fd610c6648464bfa8d489f0b5416fd568b0d Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sun, 22 Jan 2023 15:14:16 -0500 Subject: [PATCH 58/72] test button --- advanced/Scripts/webpage.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 1a34d1099f..fa81df5af1 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -60,6 +60,7 @@ Options: -sc Clear speedtest data -ss Set custom server -st Set default speedtest chart type (line, bar) + test Test the speedtest script -l, privacylevel Set privacy level (0 = lowest, 3 = highest) -t, teleporter Backup configuration as an archive -t, teleporter myname.tar.gz Backup configuration to archive with name myname.tar.gz as specified" @@ -603,6 +604,10 @@ EOF' fi } +SpeedTestTest() { + cat /var/www/html/admin/scripts/pi-hole/speedtest/speedtest-official.sh | sudo bash & +} + UpdateSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y @@ -970,6 +975,7 @@ main() { "-sc" ) ClearSpeedtestData;; "-ss" ) SpeedtestServer;; "-st" ) UpdateSpeedTestChartType;; + "test" ) SpeedTestTest;; "addcustomdns" ) AddCustomDNSAddress;; "removecustomdns" ) RemoveCustomDNSAddress;; "addcustomcname" ) AddCustomCNAMERecord;; From 251be73b705153e7f8ef69ae2061c1695db0ab66 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sun, 22 Jan 2023 15:48:06 -0500 Subject: [PATCH 59/72] make it nonblocking --- advanced/Scripts/webpage.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index fa81df5af1..379226bad0 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -605,7 +605,10 @@ EOF' } SpeedTestTest() { - cat /var/www/html/admin/scripts/pi-hole/speedtest/speedtest-official.sh | sudo bash & + if ! command -v tmux &> /dev/null; then + apt-get install tmux -y + fi + tmux new-session -d -s pimod "cat /var/www/html/admin/scripts/pi-hole/speedtest/speedtest-official.sh | sudo bash" } UpdateSpeedTest() { From 9b81447f1e5d6b1cf0994c699ff565ed769e2ded Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sun, 22 Jan 2023 15:53:58 -0500 Subject: [PATCH 60/72] add test --- advanced/Scripts/webpage.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 1a34d1099f..379226bad0 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -60,6 +60,7 @@ Options: -sc Clear speedtest data -ss Set custom server -st Set default speedtest chart type (line, bar) + test Test the speedtest script -l, privacylevel Set privacy level (0 = lowest, 3 = highest) -t, teleporter Backup configuration as an archive -t, teleporter myname.tar.gz Backup configuration to archive with name myname.tar.gz as specified" @@ -603,6 +604,13 @@ EOF' fi } +SpeedTestTest() { + if ! command -v tmux &> /dev/null; then + apt-get install tmux -y + fi + tmux new-session -d -s pimod "cat /var/www/html/admin/scripts/pi-hole/speedtest/speedtest-official.sh | sudo bash" +} + UpdateSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y @@ -970,6 +978,7 @@ main() { "-sc" ) ClearSpeedtestData;; "-ss" ) SpeedtestServer;; "-st" ) UpdateSpeedTestChartType;; + "test" ) SpeedTestTest;; "addcustomdns" ) AddCustomDNSAddress;; "removecustomdns" ) RemoveCustomDNSAddress;; "addcustomcname" ) AddCustomCNAMERecord;; From 912c670740f8342ff8f7ca613f93575aa34ddf58 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sun, 22 Jan 2023 23:29:52 -0500 Subject: [PATCH 61/72] fix timer --- advanced/Scripts/webpage.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index f20ecf4c6b..cfccbfa78a 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -591,7 +591,7 @@ EOF' Description=Pi-hole Speedtest Timer [Timer] -OnCalendar=*-*-* '$1':00:00 +OnCalendar=00/'$1':00 Persistent=true [Install] From c23be9b93f0d913a67d0f728b548e54bf265edb6 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sun, 22 Jan 2023 23:30:15 -0500 Subject: [PATCH 62/72] fix timer --- advanced/Scripts/webpage.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 379226bad0..1722da74e3 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -591,7 +591,7 @@ EOF' Description=Pi-hole Speedtest Timer [Timer] -OnCalendar=*-*-* '$1':00:00 +OnCalendar=00/'$1':00 Persistent=true [Install] From 2b79fef80cc3bd956366bfebe43683852a28de64 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Mon, 23 Jan 2023 01:11:44 -0500 Subject: [PATCH 63/72] simplify help --- advanced/Scripts/webpage.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index cfccbfa78a..ec791909f5 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -51,6 +51,7 @@ Options: -h, --help Show this help dialog -i, interface Specify dnsmasq's interface listening behavior -s, speedtest Set speedtest interval, user 0 to disable Speedtests, use -sn to prevent logging to results list + -in Reinstall Speedtest Mod -up [un] [db] Update Pi-hole (and | but uninstall) the Mod (and flush the database) -un [db] Uninstall Speedtest Mod without updating Pi-hole (and delete the database) -db Flush the database @@ -611,6 +612,13 @@ SpeedTestTest() { tmux new-session -d -s pimod "cat /var/www/html/admin/scripts/pi-hole/speedtest/speedtest-official.sh | sudo bash" } +ReinstallSpeedTest() { + if ! command -v tmux &> /dev/null; then + apt-get install tmux -y + fi + tmux new-session -d -s pimod "curl -sSLN https://github.com/arevindh/pihole-speedtest/raw/master/mod.sh | sudo bash" +} + UpdateSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y @@ -969,6 +977,7 @@ main() { "clearaudit" ) clearAudit;; "-l" | "privacylevel" ) SetPrivacyLevel;; "-s" | "speedtest" ) ChangeSpeedTestSchedule;; + "-in" ) ReinstallSpeedTest;; "-up" ) UpdateSpeedTest;; "-un" ) UninstallSpeedTest;; "-db" ) ClearSpeedtestData;; From fd4da5acfe81f0f360bc4bc5e03bd7ebf306af2f Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Mon, 23 Jan 2023 17:46:48 -0500 Subject: [PATCH 64/72] use sn --- advanced/Scripts/webpage.sh | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 662620a074..e5dc4cd2de 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -61,7 +61,6 @@ Options: -sc Clear speedtest data -ss Set custom server -st Set default speedtest chart type (line, bar) - test Test the speedtest script -l, privacylevel Set privacy level (0 = lowest, 3 = highest) -t, teleporter Backup configuration as an archive -t, teleporter myname.tar.gz Backup configuration to archive with name myname.tar.gz as specified" @@ -528,10 +527,6 @@ SpeedtestServer() { fi } -RunSpeedtestNow() { - /var/www/html/admin/scripts/pi-hole/speedtest/speedtest-official.sh -} - SpeedtestMode() { if [[ "${args[2]}" ]]; then addOrEditKeyValPair "${setupVars}" "SPEEDTEST_MODE" "${args[2]}" @@ -605,7 +600,7 @@ EOF' fi } -SpeedTestTest() { +RunSpeedtestNow() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi @@ -987,7 +982,6 @@ main() { "-sc" ) ClearSpeedtestData;; "-ss" ) SpeedtestServer;; "-st" ) UpdateSpeedTestChartType;; - "test" ) SpeedTestTest;; "addcustomdns" ) AddCustomDNSAddress;; "removecustomdns" ) RemoveCustomDNSAddress;; "addcustomcname" ) AddCustomCNAMERecord;; From 1b2b27d6e8ae955e898a2e380d65d8f0e647f8f5 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Mon, 23 Jan 2023 18:10:34 -0500 Subject: [PATCH 65/72] change repo --- advanced/Scripts/webpage.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index e5dc4cd2de..6aa447a16a 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -618,14 +618,14 @@ UpdateSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi - tmux new-session -d -s pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- up ${args[2]} ${args[3]}" + tmux new-session -d -s pimod "curl -sSLN https://github.com/arevindh/pihole-speedtest/raw/master/mod.sh | sudo bash -s -- up ${args[2]} ${args[3]}" } UninstallSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi - tmux new-session -d -s pimod "curl -sSLN https://github.com/ipitio/pihole-speedtest/raw/ipitio/mod.sh | sudo bash -s -- un ${args[2]}" + tmux new-session -d -s pimod "curl -sSLN https://github.com/arevindh/pihole-speedtest/raw/master/mod.sh | sudo bash -s -- un ${args[2]}" } SetWebUITheme() { From 5abbeb41b837eff8c1af76bb4c6da49a1a0eda55 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Tue, 24 Jan 2023 01:24:12 -0500 Subject: [PATCH 66/72] fix freq --- advanced/Scripts/webpage.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 6aa447a16a..62e30cd81f 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -567,6 +567,8 @@ SetService() { if [[ "$mode" =~ "official" ]]; then speedtest_file='/var/www/html/admin/scripts/pi-hole/speedtest/speedtest-official.sh' fi + + freq=$([ "$1" < "24" ] && echo "00/$1:00" || [ "$1" == "24" ] && echo "daily" || echo "daily,$(($1/24)):$((($1%24)*60))") sudo bash -c 'cat > /etc/systemd/system/pihole-speedtest.service << EOF [Unit] @@ -587,7 +589,7 @@ EOF' Description=Pi-hole Speedtest Timer [Timer] -OnCalendar=00/'$1':00 +OnCalendar='$freq' Persistent=true [Install] From d313747baacedaa98ee3d5e45a8c96dc9ddfa220 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Wed, 25 Jan 2023 15:47:16 -0500 Subject: [PATCH 67/72] fix if --- advanced/Scripts/webpage.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 62e30cd81f..636db46c6c 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -516,8 +516,6 @@ ChangeSpeedTestSchedule() { fi } - - SpeedtestServer() { if [[ "${args[2]}" =~ ^[0-9]+$ ]]; then addOrEditKeyValPair "${setupVars}" "SPEEDTEST_SERVER" "${args[2]}" @@ -567,8 +565,6 @@ SetService() { if [[ "$mode" =~ "official" ]]; then speedtest_file='/var/www/html/admin/scripts/pi-hole/speedtest/speedtest-official.sh' fi - - freq=$([ "$1" < "24" ] && echo "00/$1:00" || [ "$1" == "24" ] && echo "daily" || echo "daily,$(($1/24)):$((($1%24)*60))") sudo bash -c 'cat > /etc/systemd/system/pihole-speedtest.service << EOF [Unit] @@ -584,6 +580,7 @@ ExecStart='$speedtest_file' [Install] WantedBy=multi-user.target EOF' + freq=$([ "$1" -lt "24" ] && echo "00/$1:00" || [ "$1" -eq "24" ] && echo "daily" || echo "daily,$(($1/24)):$((($1%24)*60))") sudo bash -c 'cat > /etc/systemd/system/pihole-speedtest.timer << EOF [Unit] Description=Pi-hole Speedtest Timer From db5bea8f60136c1f67818725ebcec39614ace829 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sun, 29 Jan 2023 06:45:49 -0500 Subject: [PATCH 68/72] local script support --- advanced/Scripts/webpage.sh | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 636db46c6c..35aeb9a481 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -503,7 +503,7 @@ SetWebUILayout() { } ClearSpeedtestData() { - mv $speedtestdb $speedtestdb"_old" + mv $speedtestdb $speedtestdb.old cp /var/www/html/admin/scripts/pi-hole/speedtest/speedtest.db $speedtestdb } @@ -560,12 +560,7 @@ SetService() { if [[ "$1" == "0" ]]; then systemctl disable --now pihole-speedtest.timer &> /dev/null else - mode=$(sed -n -e '/SPEEDTEST_MODE/ s/.*\= *//p' $setupVars) - speedtest_file='/var/www/html/admin/scripts/pi-hole/speedtest/speedtest.sh' - if [[ "$mode" =~ "official" ]]; then - speedtest_file='/var/www/html/admin/scripts/pi-hole/speedtest/speedtest-official.sh' - fi - + speedtestfile="/var/www/html/admin/scripts/pi-hole/speedtest/speedtest-official.sh" sudo bash -c 'cat > /etc/systemd/system/pihole-speedtest.service << EOF [Unit] Description=Pi-hole Speedtest @@ -575,7 +570,7 @@ After=network.target User=root CPUQuota=20% Type=oneshot -ExecStart='$speedtest_file' +ExecStart='$speedtestfile' [Install] WantedBy=multi-user.target @@ -592,7 +587,6 @@ Persistent=true [Install] WantedBy=timers.target EOF' - systemctl daemon-reload systemctl reenable pihole-speedtest.timer &> /dev/null systemctl restart pihole-speedtest.timer @@ -603,7 +597,8 @@ RunSpeedtestNow() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi - tmux new-session -d -s pimod "cat /var/www/html/admin/scripts/pi-hole/speedtest/speedtest-official.sh | sudo bash" + speedtestscript="curl -sSLN https://github.com/arevindh/pihole-speedtest/raw/master/speedtest.sh | sudo bash || { echo \"No Internet\" && sudo sqlite3 /etc/pihole/speedtest.db \"insert into speedtest values (NULL, '$(date +"%Y-%m-%d %H:%M:%S")', '$(date +"%Y-%m-%d %H:%M:%S")', 'No Internet', '-', '-', 0, 0, 0, 0, '#');\" ; }" + tmux new-session -d -s pimod "eval $speedtestscript" } ReinstallSpeedTest() { @@ -624,7 +619,8 @@ UninstallSpeedTest() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi - tmux new-session -d -s pimod "curl -sSLN https://github.com/arevindh/pihole-speedtest/raw/master/mod.sh | sudo bash -s -- un ${args[2]}" + uninstallfile="/var/www/html/admin/scripts/pi-hole/speedtest/uninstall.sh" + tmux new-session -d -s pimod "cat $uninstallfile | sudo bash -s -- ${args[2]}" } SetWebUITheme() { From 0a06ef8370b962458da841ad8399d728a17a9f4d Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sun, 29 Jan 2023 09:20:38 -0500 Subject: [PATCH 69/72] rm var --- advanced/Scripts/webpage.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 35aeb9a481..3ae683ee9f 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -556,11 +556,10 @@ SetService() { crontab -l >crontab.tmp || true sed -i '/speedtest/d' crontab.tmp crontab crontab.tmp && rm -f crontab.tmp - + if [[ "$1" == "0" ]]; then systemctl disable --now pihole-speedtest.timer &> /dev/null else - speedtestfile="/var/www/html/admin/scripts/pi-hole/speedtest/speedtest-official.sh" sudo bash -c 'cat > /etc/systemd/system/pihole-speedtest.service << EOF [Unit] Description=Pi-hole Speedtest @@ -570,7 +569,7 @@ After=network.target User=root CPUQuota=20% Type=oneshot -ExecStart='$speedtestfile' +ExecStart=/var/www/html/admin/scripts/pi-hole/speedtest/speedtest-official.sh [Install] WantedBy=multi-user.target From b533e87c95f6002ebabdaeb83d6d31b526c94728 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sun, 29 Jan 2023 09:27:12 -0500 Subject: [PATCH 70/72] always use local speedtest --- advanced/Scripts/webpage.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 3ae683ee9f..050bbcc9f5 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -596,8 +596,7 @@ RunSpeedtestNow() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi - speedtestscript="curl -sSLN https://github.com/arevindh/pihole-speedtest/raw/master/speedtest.sh | sudo bash || { echo \"No Internet\" && sudo sqlite3 /etc/pihole/speedtest.db \"insert into speedtest values (NULL, '$(date +"%Y-%m-%d %H:%M:%S")', '$(date +"%Y-%m-%d %H:%M:%S")', 'No Internet', '-', '-', 0, 0, 0, 0, '#');\" ; }" - tmux new-session -d -s pimod "eval $speedtestscript" + tmux new-session -d -s pimod "cat /var/www/html/admin/scripts/pi-hole/speedtest/speedtest-official.sh | sudo bash" } ReinstallSpeedTest() { From 0a963e51b7c07944fba17b2c4b4df80b45089141 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Sun, 29 Jan 2023 09:33:12 -0500 Subject: [PATCH 71/72] rename to speedtest.sh --- advanced/Scripts/webpage.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 050bbcc9f5..a3b0e702e1 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -569,7 +569,7 @@ After=network.target User=root CPUQuota=20% Type=oneshot -ExecStart=/var/www/html/admin/scripts/pi-hole/speedtest/speedtest-official.sh +ExecStart=/var/www/html/admin/scripts/pi-hole/speedtest/speedtest.sh [Install] WantedBy=multi-user.target @@ -596,7 +596,7 @@ RunSpeedtestNow() { if ! command -v tmux &> /dev/null; then apt-get install tmux -y fi - tmux new-session -d -s pimod "cat /var/www/html/admin/scripts/pi-hole/speedtest/speedtest-official.sh | sudo bash" + tmux new-session -d -s pimod "cat /var/www/html/admin/scripts/pi-hole/speedtest/speedtest.sh | sudo bash" } ReinstallSpeedTest() { From 236ae445c86271ad926b67d7f28845f6f0163859 Mon Sep 17 00:00:00 2001 From: ipitio <21136719+ipitio@users.noreply.github.com> Date: Tue, 31 Jan 2023 23:18:39 -0500 Subject: [PATCH 72/72] trailing whitespace --- advanced/Scripts/webpage.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index a3b0e702e1..2d456b1943 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -556,7 +556,6 @@ SetService() { crontab -l >crontab.tmp || true sed -i '/speedtest/d' crontab.tmp crontab crontab.tmp && rm -f crontab.tmp - if [[ "$1" == "0" ]]; then systemctl disable --now pihole-speedtest.timer &> /dev/null else