mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 10:43:55 +00:00
Added possiblity for delayed reactivation of blocking
This commit is contained in:
parent
bdad454a0d
commit
f667298b64
1 changed files with 28 additions and 2 deletions
30
pihole
30
pihole
|
@ -117,6 +117,32 @@ piholeEnable() {
|
||||||
#Disable Pihole
|
#Disable Pihole
|
||||||
sed -i 's/^addn-hosts/#addn-hosts/' /etc/dnsmasq.d/01-pihole.conf
|
sed -i 's/^addn-hosts/#addn-hosts/' /etc/dnsmasq.d/01-pihole.conf
|
||||||
echo "::: Blocking has been disabled!"
|
echo "::: Blocking has been disabled!"
|
||||||
|
if [[ $# > 1 ]] ; then
|
||||||
|
if [ -x "$(command -v nohup)" ]; then
|
||||||
|
if [[ ${2} == *"s"* ]] ; then
|
||||||
|
echo "Seconds"
|
||||||
|
tt=${2%"s"}
|
||||||
|
echo "::: Blocking will be reenabled in ${tt} seconds"
|
||||||
|
echo "sleep ${tt}; pihole enable"
|
||||||
|
nohup bash -c "sleep ${tt}; pihole enable" </dev/null &>/dev/null &
|
||||||
|
elif [[ ${2} == *"m"* ]] ; then
|
||||||
|
tt=${2%"m"}
|
||||||
|
echo "::: Blocking will be reenabled in ${tt} minutes"
|
||||||
|
tt=$((${tt}*60))
|
||||||
|
echo "sleep ${tt}; pihole enable"
|
||||||
|
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 reenabled!"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "::: Command 'nohup' has to be available for this feature."
|
||||||
|
echo "::: Blocking will not automatically be reenabled!"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
#Enable pihole
|
#Enable pihole
|
||||||
echo "::: Blocking has been enabled!"
|
echo "::: Blocking has been enabled!"
|
||||||
|
@ -224,8 +250,8 @@ case "${1}" in
|
||||||
"-q" | "query" ) queryFunc "$@";;
|
"-q" | "query" ) queryFunc "$@";;
|
||||||
"-l" | "logging" ) piholeLogging "$@";;
|
"-l" | "logging" ) piholeLogging "$@";;
|
||||||
"uninstall" ) uninstallFunc;;
|
"uninstall" ) uninstallFunc;;
|
||||||
"enable" ) piholeEnable 1;;
|
"enable" ) piholeEnable 1 $2;;
|
||||||
"disable" ) piholeEnable 0;;
|
"disable" ) piholeEnable 0 $2;;
|
||||||
"status" ) piholeStatus "$2";;
|
"status" ) piholeStatus "$2";;
|
||||||
"restartdns" ) restartDNS;;
|
"restartdns" ) restartDNS;;
|
||||||
* ) helpFunc;;
|
* ) helpFunc;;
|
||||||
|
|
Loading…
Reference in a new issue