Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/pi-hole/pi-hole.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/pihole
diff options
context:
space:
mode:
Diffstat (limited to 'pihole')
-rwxr-xr-xpihole27
1 files changed, 12 insertions, 15 deletions
diff --git a/pihole b/pihole
index 84a5623f..d2ff3645 100755
--- a/pihole
+++ b/pihole
@@ -13,10 +13,11 @@ readonly PI_HOLE_SCRIPT_DIR="/opt/pihole"
readonly gravitylist="/etc/pihole/gravity.list"
readonly blacklist="/etc/pihole/black.list"
-# setupVars is not readonly here because in some funcitons (checkout),
+# setupVars and PI_HOLE_BIN_DIR are not readonly here because in some funcitons (checkout),
# it might get set again when the installer is sourced. This causes an
# error due to modifying a readonly variable.
setupVars="/etc/pihole/setupVars.conf"
+PI_HOLE_BIN_DIR="/usr/local/bin"
readonly colfile="${PI_HOLE_SCRIPT_DIR}/COL_TABLE"
source "${colfile}"
@@ -98,20 +99,16 @@ versionFunc() {
restartDNS() {
local svcOption svc str output status
- svcOption="${1:-}"
+ svcOption="${1:-restart}"
- # Determine if we should reload or restart restart
+ # Determine if we should reload or restart
if [[ "${svcOption}" =~ "reload" ]]; then
- # Using SIGHUP will NOT re-read any *.conf files
+ # Reload has been requested
+ # Note: This will NOT re-read any *.conf files
svc="killall -s SIGHUP ${resolver}"
else
- # Get PID of resolver to determine if it needs to start or restart
- if pidof pihole-FTL &> /dev/null; then
- svcOption="restart"
- else
- svcOption="start"
- fi
- svc="service ${resolver} ${svcOption}"
+ # A full restart has been requested
+ svc="service ${resolver} restart"
fi
# Print output to Terminal, but not to Web Admin
@@ -164,7 +161,7 @@ Time:
local str="Disabling blocking for ${tt} seconds"
echo -e " ${INFO} ${str}..."
local str="Blocking will be re-enabled in ${tt} seconds"
- nohup bash -c "sleep ${tt}; pihole enable" </dev/null &>/dev/null &
+ nohup bash -c "sleep ${tt}; ${PI_HOLE_BIN_DIR}/pihole enable" </dev/null &>/dev/null &
else
local error=true
fi
@@ -175,7 +172,7 @@ Time:
echo -e " ${INFO} ${str}..."
local str="Blocking will be re-enabled in ${tt} minutes"
tt=$((${tt}*60))
- nohup bash -c "sleep ${tt}; pihole enable" </dev/null &>/dev/null &
+ nohup bash -c "sleep ${tt}; ${PI_HOLE_BIN_DIR}/pihole enable" </dev/null &>/dev/null &
else
local error=true
fi
@@ -237,7 +234,7 @@ Options:
sed -i 's/^QUERY_LOGGING=true/QUERY_LOGGING=false/' /etc/pihole/setupVars.conf
if [[ "${2}" != "noflush" ]]; then
# Flush logs
- pihole -f
+ "${PI_HOLE_BIN_DIR}"/pihole -f
fi
echo -e " ${INFO} Disabling logging..."
local str="Logging has been disabled!"
@@ -290,7 +287,7 @@ statusFunc() {
*) echo -e " ${INFO} Pi-hole blocking will be enabled";;
esac
# Enable blocking
- pihole enable
+ "${PI_HOLE_BIN_DIR}"/pihole enable
fi
}