How have you set your crons to self-maintain your PiHole?

One of the things I like about Unix for tools like this is the ability to pretty much set it and forget it.

But sometimes it needs a little steering to make sure it can manage itself, so I thought it would be interesting to start a thread so we could share the tasks you set for your Pi-Hole so that it can look after itself with minimal interaction.

Hopefully this will help share ideas for us that like to tinker under the hood a bit.

I'll start with my pihole [RPi 2B]

/etc/crontab Nothing spectacular, but a wee bit of customisation in there

#       Weekly Backup Rotation
0  4 1 * *      root    tar czf /bup/backup1.tar.gz /bin /boot /etc /home /opt /root /run /sbin > /dev/null 2>1&
0  4 7 * *      root    tar czf /bup/backup2.tar.gz /bin /boot /etc /home /opt /root /run /sbin > /dev/null 2>1&
0  4 13 * *     root    tar czf /bup/backup3.tar.gz /bin /boot /etc /home /opt /root /run /sbin > /dev/null 2>1&
0  4 19 * *     root    tar czf /bup/backup4.tar.gz /bin /boot /etc /home /opt /root /run /sbin > /dev/null 2>1&
0  4 25 * *     root    tar czf /bup/backup5.tar.gz /bin /boot /etc /home /opt /root /run /sbin > /dev/null 2>1&
#
#       Monday Morning Updates
0   5 * * 1     root    apt-get update && apt-get upgrade -y && apt-get autoremove && apt-get autoclean
20  5 * * 1     root    /usr/local/bin/pihole -up > /dev/null 2>1&
30  5 * * 1     root    /sbin/reboot
#
#       AM/PM Gravity Update
0 8,18 * * *    root    /usr/local/bin/pihole -g > /dev/null 2>1&
#
#       Second Level Blacklists
0  7  * * *     root    cat /etc/pihole/regex.list.standard > /etc/pihole/regex.list && service pihole-FTL restart > /dev/null 2>1&
0  23 * * 1-5   root    cat /etc/pihole/regex.list.extra >> /etc/pihole/regex.list && service pihole-FTL restart > /dev/null 2>1&
0  1  * * 1-5   root    cat /etc/pihole/regex.list.bed >> /etc/pihole/regex.list && service pihole-FTL restart > /dev/null 2>1&
0  2  * * 6,7   root    cat /etc/pihole/regex.list.extra >> /etc/pihole/regex.list && cat /etc/pihole/regex.list.bed >> /etc/pihole/regex.list && service pihole-FTL restart > /dev/null 2>1&
2 Likes

This is not recommended. Rather than have Pi-Hole update on a schedule, you should read the release notes for each Pi-Hole release and ensure you want to update it.

What is the value of updating gravity twice a day? The blocklists don't change that frequently.

I kinda agree, but I do weekly backups, so I can always revert if I need to.

I subscribe to a list that updates daily (YT block list). Not sure which part of the day it updates, so I pull it for daytime and evening use.