From 796119a377595975f636e5f53e1996fc98458592 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Mon, 31 Oct 2016 22:02:20 +0000 Subject: [PATCH] enable or disable logging from pihole command --- pihole | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/pihole b/pihole index 4b197d12..55d82569 100755 --- a/pihole +++ b/pihole @@ -125,6 +125,27 @@ piholeEnable() { restartDNS } +piholeLogging() { + + shift + + if [[ "${1}" == "off" ]] ; then + #Disable Logging + sed -i 's/^log-queries/#log-queries/' /etc/dnsmasq.d/01-pihole.conf + sed -i 's/^queryLogging=true/queryLogging=false/' /etc/pihole/setupVars.conf + echo "::: Logging has been disabled!" + elif [[ "${1}" == "on" ]] ; then + #Enable logging + sed -i 's/^#log-queries/log-queries/' /etc/dnsmasq.d/01-pihole.conf + sed -i 's/^queryLogging=false/queryLogging=true/' /etc/pihole/setupVars.conf + echo "::: Logging has been enabled!" + else + echo "::: Invalid option passed, please pass 'on' or 'off'" + exit 1 + fi + restartDNS +} + piholeStatus() { if [[ $(cat /etc/dnsmasq.d/01-pihole.conf | grep "#addn-hosts=/") ]] ; then #list is commented out @@ -173,6 +194,7 @@ helpFunc() { ::: -h, help Show this help dialog ::: -v, version Show current versions ::: -q, query Query the adlists for a specific domain +::: -l, logging Enable or Disable logging (pass 'on' or 'off') ::: uninstall Uninstall Pi-Hole from your system :(! ::: status Is Pi-Hole Enabled or Disabled ::: enable Enable Pi-Hole DNS Blocking @@ -200,6 +222,7 @@ case "${1}" in "-h" | "help" ) helpFunc;; "-v" | "version" ) versionFunc "$@";; "-q" | "query" ) queryFunc "$@";; + "-l" | "logging" ) piholeLogging "$@";; "uninstall" ) uninstallFunc;; "enable" ) piholeEnable 1;; "disable" ) piholeEnable 0;;