Skip to content

Instantly share code, notes, and snippets.

@jamiehowarth0
Last active January 13, 2021 13:03
Show Gist options
  • Save jamiehowarth0/63284dbd506fd938ee8d1645cc0e3352 to your computer and use it in GitHub Desktop.
Save jamiehowarth0/63284dbd506fd938ee8d1645cc0e3352 to your computer and use it in GitHub Desktop.
# A crontab to turn pi-hole groups on and off at set times of day, Mon-Fri
# Replace <work group> and <personal group> with the names of your own groups that you've established.
# Both my groups are pinned to my laptop's IP, so enabling the "Work" list, which whitelists Google Analytics,
# only affects one device.
* 18 * * 1-5 root sqlite3 -line /etc/pihole/gravity.db "UPDATE [group] SET [enabled] = 0 WHERE [name] = '<work group>'; UPDATE [group] SET [enabled] = 1 WHERE [name] = '<personal group>';" && pihole restartdns reload-lists
* 9 * * 1-5 root sqlite3 -line /etc/pihole/gravity.db "UPDATE [group] SET [enabled] = 1 WHERE [name] = '<work group>'; UPDATE [group] SET [enabled] = 0 WHERE [name] = '<personal group>';" && pihole restartdns reload-lists
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment