mirror of
https://github.com/pi-hole/docker-pi-hole.git
synced 2025-12-20 02:18:51 +00:00
Create our own cron file rather than copying the one from the core repo (which contains non-standard cron syntax)
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
This commit is contained in:
@@ -48,6 +48,7 @@ RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then FTLARCH=amd64; \
|
|||||||
|
|
||||||
|
|
||||||
ADD https://ftl.pi-hole.net/macvendor.db /macvendor.db
|
ADD https://ftl.pi-hole.net/macvendor.db /macvendor.db
|
||||||
|
ADD crontab.txt /crontab.txt
|
||||||
|
|
||||||
RUN cd /etc/.pihole && \
|
RUN cd /etc/.pihole && \
|
||||||
install -Dm755 -d /opt/pihole && \
|
install -Dm755 -d /opt/pihole && \
|
||||||
@@ -57,17 +58,10 @@ RUN cd /etc/.pihole && \
|
|||||||
install -Dm755 -t /opt/pihole ./advanced/Scripts/COL_TABLE && \
|
install -Dm755 -t /opt/pihole ./advanced/Scripts/COL_TABLE && \
|
||||||
install -Dm755 -t /usr/local/bin pihole && \
|
install -Dm755 -t /usr/local/bin pihole && \
|
||||||
install -Dm644 ./advanced/bash-completion/pihole /etc/bash_completion.d/pihole && \
|
install -Dm644 ./advanced/bash-completion/pihole /etc/bash_completion.d/pihole && \
|
||||||
install -Dm644 ./advanced/Templates/pihole.cron /var/spool/cron/crontabs/pihole && \
|
|
||||||
# Randomize gravity update time
|
|
||||||
sed -i "s/59 1 /$((1 + RANDOM % 58)) $((3 + RANDOM % 2))/" /var/spool/cron/crontabs/pihole && \
|
|
||||||
# Randomize update checker time
|
|
||||||
sed -i "s/59 17/$((1 + RANDOM % 58)) $((12 + RANDOM % 8))/" /var/spool/cron/crontabs/pihole && \
|
|
||||||
# Grab some useful bits from FTL's service scripts
|
|
||||||
install -T -m 0755 ./advanced/Templates/pihole-FTL-prestart.sh /opt/pihole/pihole-FTL-prestart.sh && \
|
install -T -m 0755 ./advanced/Templates/pihole-FTL-prestart.sh /opt/pihole/pihole-FTL-prestart.sh && \
|
||||||
install -T -m 0755 ./advanced/Templates/pihole-FTL-poststop.sh /opt/pihole/pihole-FTL-poststop.sh
|
install -T -m 0755 ./advanced/Templates/pihole-FTL-poststop.sh /opt/pihole/pihole-FTL-poststop.sh
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ENV DNSMASQ_USER=pihole
|
ENV DNSMASQ_USER=pihole
|
||||||
ENV FTL_CMD=no-daemon
|
ENV FTL_CMD=no-daemon
|
||||||
RUN addgroup -S pihole && adduser -S pihole -G pihole
|
RUN addgroup -S pihole && adduser -S pihole -G pihole
|
||||||
|
|||||||
3
src/crontab.txt
Normal file
3
src/crontab.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
59 1 * * 6 PATH="$PATH:/usr/sbin:/usr/local/bin/" pihole updateGravity >/var/log/pihole/pihole_updateGravity.log || cat /var/log/pihole/pihole_updateGravity.log
|
||||||
|
00 00 * * * PATH="$PATH:/usr/sbin:/usr/local/bin/" pihole flush once quiet
|
||||||
|
59 17 * * * PATH="$PATH:/usr/sbin:/usr/local/bin/" pihole updatechecker
|
||||||
10
src/start.sh
10
src/start.sh
@@ -69,7 +69,15 @@ sh /opt/pihole/pihole-FTL-prestart.sh
|
|||||||
capsh --user=$DNSMASQ_USER --keep=1 -- -c "/usr/bin/pihole-FTL $FTL_CMD >/dev/null" &
|
capsh --user=$DNSMASQ_USER --keep=1 -- -c "/usr/bin/pihole-FTL $FTL_CMD >/dev/null" &
|
||||||
|
|
||||||
# Start crond for scheduled scripts (logrotate, pihole flush, gravity update etc)
|
# Start crond for scheduled scripts (logrotate, pihole flush, gravity update etc)
|
||||||
crond
|
# crond
|
||||||
|
|
||||||
|
# Randomize gravity update time
|
||||||
|
sed -i "s/59 1 /$((1 + RANDOM % 58)) $((3 + RANDOM % 2))/" /crontab.txt
|
||||||
|
# Randomize update checker time
|
||||||
|
sed -i "s/59 17/$((1 + RANDOM % 58)) $((12 + RANDOM % 8))/" /crontab.txt
|
||||||
|
/usr/bin/crontab /crontab.txt
|
||||||
|
|
||||||
|
/usr/sbin/crond
|
||||||
|
|
||||||
pihole -g
|
pihole -g
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user