Cron <root@Dietpi> cd / && run-parts --report /etc/cron.hourly

  • DietPi version | cat /boot/dietpi/.version
    G_DIETPI_VERSION_CORE=8
    G_DIETPI_VERSION_SUB=20
    G_DIETPI_VERSION_RC=1
    G_GITBRANCH=‘master’
    G_GITOWNER=‘MichaIng’

  • Distro version | echo $G_DISTRO_NAME $G_RASPBIAN
    “bullseye” and “bullseye 1”

  • Kernel version | uname -a
    “Linux xxx 5.10.0-23-amd64 #1 SMP Debian 5.10.179-3 (2023-07-27) x86_64 GNU/Linux”
    and
    “Linux xxx 6.1.21+ #1642 Mon Apr 3 17:19:14 BST 2023 armv6l GNU/Linux”

  • Architecture | dpkg --print-architecture
    “amd64” and “armhf”

  • SBC model | echo $G_HW_MODEL_NAME or (EG: RPi3)
    “Native PC (x86_64)” and “RPi B+ (armv6l)”

Hey DietPi Forum.
After doing a “sudo dietpi-update” and updating to
DietPi v8.20.1
on 4 different machines, now i get every hour 4 e-mails, with the Subject
“Cron root@Dietpi cd / && run-parts --report /etc/cron.hourly”
and content:
/etc/cron.hourly/dietpi:
truncate: missing file operand
Try ‘truncate --help’ for more information

What can i do, to solve this problem?

I didn’t changed the file.

sudo cat /etc/cron.hourly/dietpi
#!/bin/bash
{
        #////////////////////////////////////
        # DietPi Cron.Hourly script
        #
        #////////////////////////////////////
        #
        # Info:
        # - Location: /etc/cron.hourly/dietpi
        #
        #////////////////////////////////////

        # Assure that whiptail dialogues are skipped, even when the script is called manually, since STDOUT is redirected
        export G_INTERACTIVE=0

        #----------------------------------------------------------------
        # Main Loop
        #----------------------------------------------------------------
        # Sync system time, if mode 3 (hourly) is detected
        grep -q '^[[:blank:]]*CONFIG_NTP_MODE=3' /boot/dietpi.txt && /boot/dietpi/func/run_ntpd 1
        #----------------------------------------------------------------
        # Clear /var/log files, if DietPi-RAMlog is detected
        [[ -f '/boot/dietpi/.installed' ]] && INDEX_LOGGING=$(sed -n '/^[[:blank:]]*INDEX_LOGGING=/{s/^[^=]*=//p;q}' /boot/dietpi/.installed)
        # - Mode -1: Clear only
        if (( ${INDEX_LOGGING:=0} == -1 )); then

                /boot/dietpi/func/dietpi-logclear 1

        # - Mode -2: Append logs at /root/logfile_storage, then clear
        elif (( $INDEX_LOGGING == -2 )); then

                /boot/dietpi/func/dietpi-logclear 0

        fi
        #----------------------------------------------------------------
        exit
        #----------------------------------------------------------------
} > /dev/null

Thanks,
Tuffi

it’s not the cron job that changed, it’s` Fix dietpi-logclear failing on files in sticky bit directories by Timoses · Pull Request #6507 · MichaIng/DietPi · GitHub

Will ask the developer to have a look

1 Like

Exactly. It is visual only, but of course nasty when you get mails because of this. To fix:

curl -sSfo /boot/dietpi/func/dietpi-logclear 'https://raw.githubusercontent.com/MichaIng/DietPi/master/dietpi/func/dietpi-logclear'
2 Likes

Thank you very much.
The hourly mails are gone.