Hallo,
ich habe nach dem neuesten Update nicht mehr die Möglichkeit, den Gravity Job anzupassen.
Das habe ich immer wie folgt gemacht:
Prüfung:
grep updateGravity /etc/cron.d/pihole
Anpassung:
sudo sed -i '/updateGravity/ s/^.*root/15 4 * * * root/' /etc/cron.d/pihole
Ergebnis ist dann immer noch:
26 4 * * 7 pihole PATH="$PATH:/usr/sbin:/usr/local/bin/" pihole updateGravity >/var/log/pihole/pihole_updateGravity.log || cat /var/log/pihole/pihole_updateGravity.log
Aber er ändert es nicht mehr. Eine Fehlermeldung wird auch nicht ausgegeben.
Weiß jemand was ich ändern muss, damit es wieder geht?
Vielen Dank.
Hallo,
in Core 6.4.2 läuft der Gravity Job nicht mehr als root sondern als pihole (tatsächlich eine Änderung von mir)
Dein sed laue jetzt:
sudo sed -i '/updateGravity/ s/^.*pihole/15 4 * * * pihole/' /etc/cron.d/pihole
(Ich habe nut root mit pihole ersetzt)
In der Zeile des cronjobs siehst du, dass nirgendwo mehr root vorkommt, sondern eben pihole:
26 4 * * 7 pihole PATH="$PATH:/usr/sbin:/usr/local/bin/" pihole updateGravity >/var/log/pihole/pihole_updateGravity.log || cat /var/log/pihole/pihole_updateGravity.log
Ah, ok. Das Prüfungsergebnis sieht besser aus, auch wenn es kürzer ist:
15 4 * * * pihole_updateGravity.log
Ich hoffe, dass passt nun?
Ich bin kein sed-Experte, aber jetzt befindet sich das Wort pihole mehrmals in der Zeile. Das führt dazu, dass sed zu viel verändert.
Ich hab selbst etwas herumprobiert und folgendes sollte es tun:
sudo sed -i '/pihole PATH/ s|^[^p]*pihole|15 4 * * * pihole|' /etc/cron.d/pihole
Stelle davor die Ursprungszeile von
15 4 * * * pihole_updateGravity.log
auf
26 4 * * 7 pihole PATH="$PATH:/usr/sbin:/usr/local/bin/" pihole updateGravity >/var/log/pihole/pihole_updateGravity.log || cat /var/log/pihole/pihole_updateGravity.log
wieder her
Das geht nicht mehr, selbst mit sudo nicht.
Oh man, jetzt hab ich mir echt den pihole zerschossen
Ich spiele mal das Backup ein und versuche es dann nochmal ...
So, das sieht besser oder ?
Prüfung:
26 3 * * 7 pihole PATH="$PATH:/usr/sbin:/usr/local/bin/" pihole updateGravity >/var/log/pihole/pihole_updateGravity.log || cat /var/log/pihole/pihole_updateGravity.log
Änderung:
sudo sed -i '/pihole PATH/ s|^[^p]*pihole|15 4 * * * pihole|' /etc/cron.d/pihole
Erneute Prüfung:
15 4 * * * pihole PATH="$PATH:/usr/sbin:/usr/local/bin/" pihole updateGravity >/var/log/pihole/pihole_updateGravity.log || cat /var/log/pihole/pihole_updateGravity.log
Das sieht jetzt soweit passend aus um Gravity täglich statt nur sonntags laufen zu lassen.
TOP! Herzlichen Dank für die Hilfe!
EDIT Never mind this one ... oops.
Above one is working for me when I omit the -i argument (and still with the root user):
$ sudo sed '/updateGravity/ s/^.*root/15 4 * * * root/' /etc/cron.d/pihole
# Pi-hole: A black hole for Internet advertisements
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
# Network-wide ad blocking via your own hardware.
#
# Updates ad sources every week
#
# This file is copyright under the latest version of the EUPL.
# Please see LICENSE file for your rights under this license.
#
#
#
# This file is under source-control of the Pi-hole installation and update
# scripts, any changes made to this file will be overwritten when the software
# is updated or re-installed. Please make any changes to the appropriate crontab
# or other cron file snippets.
# Pi-hole: Update the ad sources once a week on Sunday at a random time in the
# early morning. Download any updates from the adlists
# Squash output to log, then splat the log to stdout on error to allow for
# standard crontab job error handling.
15 4 * * * root PATH="$PATH:/usr/sbin:/usr/local/bin/" pihole updateGravity >/var/log/pihole/pihole_updateGravity.log || cat /var/log/pihole/pihole_updateGravity.log
Below the original from the default install:
$ grep updateGravity /etc/cron.d/pihole
22 3 * * 7 root PATH="$PATH:/usr/sbin:/usr/local/bin/" pihole updateGravity >/var/log/pihole/pihole_updateGravity.log || cat /var/log/pihole/pihole_updateGravity.log
The thing that went wrong with the sed was the username was not root but pihole instead in your cron job.
Im guessing you missed the Core 6.4.2 release last night (merge commit was created Fri Apr 24 22:56:21 2026 +0100, blog post on 2026-04-24T22:15:11.854Z)
That release changed the cronjob from root to pihole user.
#
# This file is under source-control of the Pi-hole installation and update
# scripts, any changes made to this file will be overwritten when the software
# is updated or re-installed. Please make any changes to the appropriate crontab
# or other cron file snippets.
# Pi-hole: Update the ad sources once a week on Sunday at a random time in the
# early morning. Download any updates from the adlists
# Squash output to log, then splat the log to stdout on error to allow for
# standard crontab job error handling.
59 1 * * 7 pihole PATH="$PATH:/usr/sbin:/usr/local/bin/" pihole updateGravity >/var/log/pihole/pihole_updateGravity.log || cat /var/log/pihole/pihole_updateGravity.log
# Pi-hole: Flush the log daily at 00:00
# The flush script uses logrotate
# parameter "once": logrotate only once (default is twice)
# parameter "quiet": don't print messages
00 00 * * * root PATH="$PATH:/usr/sbin:/usr/local/bin/" pihole flush once quiet
@reboot root /usr/sbin/logrotate --state /var/lib/logrotate/pihole /etc/pihole/logrotate
# Pi-hole: Grab remote and local version every 24 hours
Yeah sorry I just meant to say the initial sed syntax was ok.
But the username wasnt
Good job!
EDIT: Oh and pointing out that you run the sed first without the -i argument to see results first before applying.
This works:
sudo sed -i '/pihole PATH/ s|^[^p]*pihole|15 4 * * * pihole|' /etc/cron.d/pihole
Thanks again