Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- # ads.sh: Enables or disables ad-blocking list generated
- # by gravity.sh. dnsmasq is reloaded following any changes.
- # Called without argument toggles the list on or off. If
- # time is specified ad-blocking will resume after that time.
- # Usage: ads.sh NUM[m/h/d]. Ex: ads.sh 20m
- list=/etc/pihole/gravity.list
- reload() { systemctl restart dnsmasq; }
- gravity_on() { mv $list.disabled $list; reload; }
- gravity_off() { mv $list $list.disabled; reload; }
- if [ ! -z "$1" ];then
- if [ -f $list ];then
- gravity_off & echo "Ad-blocking disabled for $1"
- ( sleep $1 && gravity_on ) &
- else
- echo "Ad-blocking already disabled"
- fi
- else
- if [ -f $list ];then
- gravity_off & echo "Ad-blocking disabled"
- else
- gravity_on & echo "Ad-blocking enabled"
- fi
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement