A simple script to enable/disable pihole groups (pihole associations with specific clients, whitelists, blacklists, etc.). Using cronjobs, groups can be active during specific times in a day.
- Clone the repo
- Make script executable:
chmod +x update-group.sh
- Setup group in pihole
- Setup cronjobs to enable/disable groups
We're taking advantage of pihole groups in order to manage our domains.
- Log into your pihole
- Navigate to
Group Management
- Create a new Group
- Assign your desired clients to your new Group
- Configure your
Domains
orAdlists
for domains you want to block - Your domains and adlists should all be assigned under the new group
Note: Adlists can only contain specific domains and you can point it to local files using the file:///path/to/adlist
syntax
Using cronjobs, the script can be configured to enable or disable the specified pihole group as specific times.
- Edit cronjobs using:
crontab -e
- Configure your cronjobs for enabling/disabling pihole group
These example cronjobs will turn on a group from 12am - 5pm every weekday
# 12am everyday from Monday - Friday. Enable the group list as the pihole user
0 0 * * 1-5 pihole /path/to/script/update-groups.sh <GroupName> enable
# 5pm everyday from Monday - Friday. Disable the group as the pihole user
0 0 * * 1-5 pihole /path/to/script/update-groups.sh <GroupName> disable