mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-04-06 15:40:17 +00:00
added speedtest cli also
This commit is contained in:
parent
f0e43a53c3
commit
4ff84b1ffd
1 changed files with 22 additions and 1 deletions
|
@ -46,6 +46,7 @@ Options:
|
||||||
use -sn to prevent logging to results list
|
use -sn to prevent logging to results list
|
||||||
-sd Set speedtest display range
|
-sd Set speedtest display range
|
||||||
-sn Run speedtest now
|
-sn Run speedtest now
|
||||||
|
-sm Speedtest Mode
|
||||||
-sc Clear speedtest data
|
-sc Clear speedtest data
|
||||||
-ss Set custom server
|
-ss Set custom server
|
||||||
-l, privacylevel Set privacy level (0 = lowest, 4 = highest)"
|
-l, privacylevel Set privacy level (0 = lowest, 4 = highest)"
|
||||||
|
@ -462,6 +463,17 @@ RunSpeedtestNow(){
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SpeedtestMode(){
|
||||||
|
if [[ "${args[2]}" ]]; then
|
||||||
|
change_setting "SPEEDTEST_MODE" "${args[2]}"
|
||||||
|
else
|
||||||
|
# Autoselect for invalid data
|
||||||
|
change_setting "SPEEDTEST_MODE" "python"
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
SetCronTab()
|
SetCronTab()
|
||||||
{
|
{
|
||||||
# Remove OLD
|
# Remove OLD
|
||||||
|
@ -474,7 +486,15 @@ SetCronTab()
|
||||||
if [[ "$1" == "0" ]]; then
|
if [[ "$1" == "0" ]]; then
|
||||||
crontab crontab.tmp && rm -f crontab.tmp
|
crontab crontab.tmp && rm -f crontab.tmp
|
||||||
else
|
else
|
||||||
newtab="0 */"${1}" * * * sudo \""${speedtestfile}"\" > /dev/null 2>&1"
|
mode=$(sed -n -e '/SPEEDTEST_MODE/ s/.*\= *//p' $setupVars)
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
newtab="0 */"${1}" * * * sudo \""${speedtest_file}"\" > /dev/null 2>&1"
|
||||||
printf '%s\n' "$newtab" >>crontab.tmp
|
printf '%s\n' "$newtab" >>crontab.tmp
|
||||||
crontab crontab.tmp && rm -f crontab.tmp
|
crontab crontab.tmp && rm -f crontab.tmp
|
||||||
fi
|
fi
|
||||||
|
@ -740,6 +760,7 @@ main() {
|
||||||
"-s" | "speedtest" ) ChageSpeedTestSchedule;;
|
"-s" | "speedtest" ) ChageSpeedTestSchedule;;
|
||||||
"-sd" ) UpdateSpeedTestRange;;
|
"-sd" ) UpdateSpeedTestRange;;
|
||||||
"-sn" ) RunSpeedtestNow;;
|
"-sn" ) RunSpeedtestNow;;
|
||||||
|
"-sm" ) SpeedtestMode;;
|
||||||
"-sc" ) ClearSpeedtestData;;
|
"-sc" ) ClearSpeedtestData;;
|
||||||
"-ss" ) SpeedtestServer;;
|
"-ss" ) SpeedtestServer;;
|
||||||
"addcustomdns" ) AddCustomDNSAddress;;
|
"addcustomdns" ) AddCustomDNSAddress;;
|
||||||
|
|
Loading…
Add table
Reference in a new issue