mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[fix] Add random delay to app fetchlist cron job (#297)
* Add random delay to app fetchlist cron job * Split the sleep and yunohost command on two lines
This commit is contained in:
parent
1516f48699
commit
c502b8c348
1 changed files with 8 additions and 1 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue