diff --git a/src/yunohost/app.py b/src/yunohost/app.py index 10f617228..2f80d0ac2 100644 --- a/src/yunohost/app.py +++ b/src/yunohost/app.py @@ -1933,8 +1933,15 @@ def _install_appslist_fetch_cron(): logger.debug("Installing appslist fetch cron job") + cron_job = [] + cron_job.append("#!/bin/bash") + # We add a random delay between 0 and 60 min to avoid every instance fetching + # the appslist at the same time every night + cron_job.append("(sleep $((RANDOM%3600));") + cron_job.append("yunohost app fetchlist > /dev/null 2>&1) &") + with open(cron_job_file, "w") as f: - f.write('#!/bin/bash\n\nyunohost app fetchlist > /dev/null 2>&1\n') + f.write('\n'.join(cron_job)) _set_permissions(cron_job_file, "root", "root", 0755)