Cron does not run


DietPi version | G_DIETPI_VERSION_CORE=8
Distro version | bookworm 1
Kernel version | Linux HyperPi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux
Architecture | armhf
SBC model | RPi 4 Model B (aarch64)

in cron minutely I have a script named UpdateDNS.
I can run the script manually and it works fine.

Run-parts gives this output:

sudo run-parts --verbose --debug /etc/cron.minutely/
"readme.txt": classicalre fail
".": classicalre fail
"UpdateDNS": classicalre pass
"..": classicalre fail

root@HyperPi:~# sudo run-parts --verbose --debug --lsbsysinit /etc/cron.minutely/
"readme.txt": tradre fail
".": tradre fail
"updatedns": tradre pass
"..": tradre fail

The script containts this:
exec /opt/DDNS/ -z mykey -Z mydomain -r otherkey -n nc

When I execute this command directly it works.

What am I missing here :slight_smile: ?


Looks like the shebang is missing a #.
Can you also share ls -la /etc/cron.minutely

It’s also possible that inside the are commands with relative path instead of absolute ones? Can you share this as well?

1 Like

some more hints Cronjob not running - #5 by Joulinar

1 Like

oh, seems that # got missing during copy paste in the post here. :sweat_smile: It is in the config file :slight_smile:

drwxr-xr-x 2 root root 4096 21. Aug 01:20 .
drwxr-xr-x 112 root root 12288 21. Aug 00:21 …
-rw-r–r-- 1 root root 163 30. Jul 16:49 readme.txt
-rw-r–r-- 1 root root 121 21. Aug 01:16 updatedns

oh, WTF, seems that +x got missing during my trials. I had set this in the beginning. could this get lost during renaming?
Thank you, that was it!!

Damn, why does run-parts not mention this, really sucks. :frowning:

Did you run dietpi-cron and enabled the minutely cron?

No, permissions shouldn’t change when renaming, but sure the permission to execute is needed.
edit: I just saw now your post.