Logrotate problem

hi,
When pihole logrotate script run,i took an error.The logrotate script is;
root@xxx:/etc/cron.d# more 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 softare
# 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.
2 4   * * 7   root    PATH="$PATH:/usr/local/bin/" pihole updateGravity >/var/log/pihole_updateGravity.log || cat /var/log/pi
hole_updateGravity.log

# Pi-hole: Flush the log daily at 00:00
#          The flush script will use logrotate if available
#          parameter "once": logrotate only once (default is twice)
#          parameter "quiet": don't print messages
**49 08 * * *   root    PATH="$PATH:/usr/local/bin/" pihole flush once quiet**

@reboot root /usr/sbin/logrotate /etc/pihole/logrotate

# Pi-hole: Grab local version and branch every 10 minutes
30 13 *  * * *   root    PATH="$PATH:/usr/local/bin/" pihole updatechecker local

# Pi-hole: Grab remote version every 24 hours
45 14  * * *   root    PATH="$PATH:/usr/local/bin/" pihole updatechecker remote
@reboot root    PATH="$PATH:/usr/local/bin/" pihole updatechecker remote reboot

the problem is
49 08 * * * root PATH="$PATH:/usr/local/bin/" pihole flush once quiet
when was this command run,i took an error.tihs syslog look like;

Nov 25 08:49:01 xx cron[1001]: (systempihole) RELOAD (/etc/cron.d/pihole)
Nov 25 08:49:01 xx cron[1001]: Error: bad username; while reading /etc/cron.d/pihole
Nov 25 08:49:01xx cron[1001]: (systempihole) ERROR (Syntax error, this crontab file will be ignored)

No permission problem ;

root@xx:/etc/cron.d# ls -l
total 20
-rw-r--r-- 1 root root  285 May 29  2017 anacron
-rw-r--r-- 1 root root  589 Oca 30  2019 mdadm
-rw-r--r-- 1 root root  712 Oca 18  2018 php
-rw-r--r-- 1 root root 1706 Kas 25 08:57 pihole

Other scripts are no problem,they are runnning.But this script isnt.
Can you help me ?

The offending line seems to be this

It seems you were trying to configure that to run just once a day at 13:30 :clock130:, but introduced an error in doing so: Your file has been edited supplying one * too many, causing cron to see that asterisk for the username, instead of the following root.

In contrast, the original default content reads:
*/10 * * * * root PATH="$PATH:/usr/local/bin/" pihole updatechecker local

Apart from the *-typo, I’d leave that job running a bit more frequently than just once a day, as it was scheduled to run every 10 minutes by default.

Also, I am assuming that the leading/trailing ** for the line you suspected have been injected by the discourse editor in an attempt to boldly highlight the line. If not, remove those as well.

Bucking_Horn
i edited this file and then i runned manually the script.
06 00 * * * root PATH="$PATH:/usr/local/bin/" pihole updatechecker local >/root/a

more /root/a
[✓] Flushed /var/log/pihole.log
[✓] Deleted queries from database

root@xx:/etc/cron.d# more 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 softare
# 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.
2 4   * * 7   root    PATH="$PATH:/usr/local/bin/" pihole updateGravity >/var/lo
g/pihole_updateGravity.log || cat /var/log/pihole_updateGravity.log

# Pi-hole: Flush the log daily at 00:00
#          The flush script will use logrotate if available
#          parameter "once": logrotate only once (default is twice)
#          parameter "quiet": don't print messages
05 00 * * *   root    PATH="$PATH:/usr/local/bin/" pihole flush once > /root/a
#09 14 * * *  /usr/local/bin/pihole flush once > /root/a

@reboot root /usr/sbin/logrotate /etc/pihole/logrotate

# Pi-hole: Grab local version and branch every 10 minutes
#*/10 * * * *   root    PATH="$PATH:/usr/local/bin/" pihole updatechecker local
35 14 * * *   root      PATH="$PATH:/usr/local/bin/" pihole updatechecker local

# Pi-hole: Grab remote version every 24 hours
45 14  * * *   root    PATH="$PATH:/usr/local/bin/" pihole updatechecker remote
@reboot root    PATH="$PATH:/usr/local/bin/" pihole updatechecker remote reboot

The problem is solved.

Thank you very much for your help,

Regards

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.