Categories
How-To Guides

Automatically Update Pi-hole Daily

Cron is a great sysadmin tool, but it seems like my cronjobs never run because I can’t quite get syntax or permissions right.

Here’s my “how to use cron to (actually) update your Pi-hole daily” guide.

First, run:

sudo crontab -e 

(I know that running ‘pihole-up’ doesn’t require sudo, but cron gets angry without it.)

Add the following line to the cron file:

0 5 * * * /usr/bin/date >> /var/log/pihole_update.log && /usr/local/bin/pihole -up >> /var/log/pihole_update.log 2>&1

This will cause pihole to update every morning at 5:00 am, and log the results to /var/log/pihole_update.log preceded by a timestamp (so you know it’s actually working). (If you prefer updates weekly instead of daily, change 0 5 * * * to 0 5 * * 0 and updates will happen at 5:00 am every Sunday instead.)

Pi-hole updates, automated.

Leave a Reply

Your email address will not be published. Required fields are marked *