Cron throwing up a syntax error every hour since upgrade to 11

My YunoHost server

Hardware: VPS bought online
YunoHost version: 11.0.9.3 (stable)
I have access to my server : Through SSH | through the webadmin
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : no (not that I remember)

Description of my issue

My update to Yunohost 11 went smoothly, but ever since it has been sending an email to me every hour with this text

/sbin/run-parts: line 5: 127011 127011: syntax error in expression (error token is "127011")

The contents of `/sbin/run-parts is

#!/bin/bash

parameters="$@"
ip=$(hostname -i)
RANDOM=${ip//./}
test -z "${parameters##*/etc/cron.*}" &&
        sleep $((RANDOM % 3600))

exec /bin/run-parts "$@"

Can anyone shed some light onto what is going wrong? Where is the run-parts file from and does it do?

Thanks

I ran the bash script through a syntax checker (ShellCheck) it points out line 3 as the error

Line 3:
parameters="$@"
           ^-- SC2124 (warning): Assigning an array to a string! Assign as array, or use * instead of @ to concatenate.

Which is different to the line 5 indicated in the email.

In case it’s helpful the email subject line is

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

what are the scripts you got in /etc/cron.hourly/ folder? Any of them that seem related?

Just fake-hwclock which saves the clock time periodically

The same issue is talked about in here, also in relation to a debian 11 upgrade

They say the script is to randomise execution of cron jobs. I did not add this, but if it is a Yunohost feature, why is everyone not getting this bug?

I don’t think it’s specific to Yunohost, it depends on which debian you installed it. Did you install from an yunohost image or from somewhere else?

Yeah the thread on superuser/stackoverflow also suggests that this script is not default debian …

After testing this on my machine, it seems the issue is not really a syntax error (?), but is related to affecting a value to RANDOM which is a special variable in bash and is not supposed to be overwritten …

Edit: one simple fix could maybe to replace RANDOM by random, line 5 and line 7, ie a different variable name

Thanks, I’ve made these changes.

Is this script most likely to be from an app I have installed? or if I installed YH over a Debian image my VPS host supplied could it have been put in then?

It could be your VPS provider yeah, they may have made this tweak to prevent all cron jobs to be triggered exactly at the same time on all their VPS fleet to prevent huge CPU/RAM spikes

Cool, I’ll reach out to them. Thanks for your help

renaming the RANDOM variable did not seem to resolve it. I just received another of these emails. I’ve reached out to my VPS. At guess I can try removing the contents of the file and see if that resolves it.

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