|
|
|
@ -122,6 +122,24 @@ piholeEnable() {
|
|
|
|
|
#Disable Pihole
|
|
|
|
|
sed -i 's/^addn-hosts/#addn-hosts/' /etc/dnsmasq.d/01-pihole.conf
|
|
|
|
|
echo "::: Blocking has been disabled!"
|
|
|
|
|
if [[ $# > 1 ]] ; then
|
|
|
|
|
if [[ ${2} == *"s"* ]] ; then
|
|
|
|
|
tt=${2%"s"}
|
|
|
|
|
echo "::: Blocking will be re-enabled in ${tt} seconds"
|
|
|
|
|
nohup bash -c "sleep ${tt}; pihole enable" </dev/null &>/dev/null &
|
|
|
|
|
elif [[ ${2} == *"m"* ]] ; then
|
|
|
|
|
tt=${2%"m"}
|
|
|
|
|
echo "::: Blocking will be re-enabled in ${tt} minutes"
|
|
|
|
|
tt=$((${tt}*60))
|
|
|
|
|
nohup bash -c "sleep ${tt}; pihole enable" </dev/null &>/dev/null &
|
|
|
|
|
else
|
|
|
|
|
echo "::: Unknown format for delayed reactivation of the blocking!"
|
|
|
|
|
echo "::: Example:"
|
|
|
|
|
echo "::: pihole disable 5s - will disable blocking for 5 seconds"
|
|
|
|
|
echo "::: pihole disable 7m - will disable blocking for 7 minutes"
|
|
|
|
|
echo "::: Blocking will not automatically be re-enabled!"
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
else
|
|
|
|
|
#Enable pihole
|
|
|
|
|
echo "::: Blocking has been enabled!"
|
|
|
|
@ -205,6 +223,8 @@ helpFunc() {
|
|
|
|
|
::: status Is Pi-Hole Enabled or Disabled
|
|
|
|
|
::: enable Enable Pi-Hole DNS Blocking
|
|
|
|
|
::: disable Disable Pi-Hole DNS Blocking
|
|
|
|
|
::: Blocking can also be disabled only temporarily, e.g.,
|
|
|
|
|
::: pihole disable 5m - will disable blocking for 5 minutes
|
|
|
|
|
::: restartdns Restart dnsmasq
|
|
|
|
|
EOM
|
|
|
|
|
exit 1
|
|
|
|
@ -231,7 +251,7 @@ case "${1}" in
|
|
|
|
|
"-l" | "logging" ) piholeLogging "$@";;
|
|
|
|
|
"uninstall" ) uninstallFunc;;
|
|
|
|
|
"enable" ) piholeEnable 1;;
|
|
|
|
|
"disable" ) piholeEnable 0;;
|
|
|
|
|
"disable" ) piholeEnable 0 $2;;
|
|
|
|
|
"status" ) piholeStatus "$2";;
|
|
|
|
|
"restartdns" ) restartDNS;;
|
|
|
|
|
"-a" | "admin" ) webpageFunc "$@";;
|
|
|
|
|