{"id":19950992,"url":"https://github.com/webpwnized/pihole-automation","last_synced_at":"2025-05-03T18:33:26.932Z","repository":{"id":96775676,"uuid":"174866806","full_name":"webpwnized/pihole-automation","owner":"webpwnized","description":"Scripts to automate maintenance of Pi-Hole DNS server","archived":false,"fork":false,"pushed_at":"2025-01-03T23:19:22.000Z","size":59,"stargazers_count":13,"open_issues_count":0,"forks_count":6,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-07T19:51:58.021Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/webpwnized.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-03-10T18:54:12.000Z","updated_at":"2024-12-20T23:35:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"c15cd728-cfef-4e1d-9cf5-15e1bff66d44","html_url":"https://github.com/webpwnized/pihole-automation","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpwnized%2Fpihole-automation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpwnized%2Fpihole-automation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpwnized%2Fpihole-automation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpwnized%2Fpihole-automation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webpwnized","download_url":"https://codeload.github.com/webpwnized/pihole-automation/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252236444,"owners_count":21716403,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T01:06:27.002Z","updated_at":"2025-05-03T18:33:26.569Z","avatar_url":"https://github.com/webpwnized.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Pi-hole Automation\n\n**Pi-hole Automation** is a collection of scripts designed to automate maintenance tasks for a Pi-hole DNS server and its underlying Raspberry Pi operating system. These scripts are scheduled with `cron` to ensure that the Pi-hole instance and the system are always up-to-date and performing optimally.\n\n## Project Structure\n\n- **cron-jobs/cron.custom/**: Contains custom cron job scripts for different maintenance tasks, including Debian updates, Pi-hole gravity updates, Pi-hole software updates, and Raspberry Pi firmware updates.\n- **crontab**: A sample crontab configuration file, defining specific times for each maintenance task.\n- **lists.txt**: A list of URLs to popular blocklists that can be imported into Pi-hole, providing a baseline for ad-blocking and privacy protection.\n\n## Scripts\n\nThe following scripts are included in the `cron-jobs/cron.custom/` directory and are intended to be scheduled with cron for automated execution.\n\n### Daily Updates\n\nThese scripts perform daily maintenance to ensure Pi-hole and the underlying system are up-to-date.\n\n- **`update-debian.sh`**: Updates the Debian operating system on the Raspberry Pi using `apt`. This includes fetching and applying package updates for system stability and security.\n- **`update-gravity.sh`**: Updates Pi-hole’s gravity list, which refreshes the blocklists used to block ads and trackers, keeping them current.\n- **`update-pihole.sh`**: Updates the Pi-hole software itself, ensuring the latest features and security patches are applied.\n\n### Monthly Updates\n\nThis script performs a less frequent, but essential, update to the Raspberry Pi’s firmware.\n\n- **`update-pi-firmware.sh`**: Updates the Raspberry Pi firmware using `rpi-update`, which may include performance enhancements and hardware compatibility improvements. This script is scheduled to run monthly to keep the firmware up-to-date without risking frequent interruptions.\n\n## Usage\n\n### Setting Up the Cron Jobs\n\n1. **Move Scripts to Custom Directory**:\n   Place the scripts in `/etc/cron.custom/` to prevent them from being run by default cron directories (e.g., `/etc/cron.daily`). This allows for precise scheduling.\n\n   ```bash\n   sudo mkdir -p /etc/cron.custom\n   sudo cp cron-jobs/cron.custom/* /etc/cron.custom/\n   sudo chmod +x /etc/cron.custom/*.sh\n   ```\n\n2. **Configure the Crontab**:\n   Use the provided `crontab` file as a template to schedule each script at the specified times. Open the root crontab and add entries for each script.\n\n   ```bash\n   sudo crontab -e\n   ```\n\n   Then, add the contents of the provided `crontab` file to set the desired schedule.\n\n### Example Crontab Schedule\n\nThe `crontab` file schedules each script with specific times for daily and monthly tasks:\n- **Debian updates**: 2:00 AM daily\n- **Pi-hole gravity updates**: 3:00 AM daily\n- **Pi-hole software updates**: 4:00 AM daily\n- **Raspberry Pi firmware updates**: 5:00 AM on the 1st of each month\n\nThis configuration ensures the Pi-hole instance and Raspberry Pi are maintained without interfering with each other or other system tasks.\n\n### Importing Blocklists\n\nThe `lists.txt` file includes popular URLs for blocklists that can be imported into Pi-hole. To use these blocklists:\n1. Open the Pi-hole web interface.\n2. Go to **Group Management \u003e Adlists**.\n3. Copy the URLs from `lists.txt` and paste them into the Adlists section.\n\n## Logs\n\nEach script logs its output to a unique file in `/var/log/`, making it easy to review and troubleshoot:\n- **Debian update log**: `/var/log/update-debian-cron.log`\n- **Gravity update log**: `/var/log/update-gravity-cron.log`\n- **Pi-hole update log**: `/var/log/update-pihole-cron.log`\n- **Firmware update log**: `/var/log/update-pi-firmware-cron.log`\n\nCheck these logs periodically to verify that each task completes successfully.\n\n## License\n\nThis project is licensed under the GNU GPL v3. See the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebpwnized%2Fpihole-automation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebpwnized%2Fpihole-automation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebpwnized%2Fpihole-automation/lists"}