From a4160443766e353cee2ae6a79236718dd6d551f3 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Fri, 22 Nov 2019 14:58:11 +0100 Subject: [PATCH] Add diagnosis cron job to be ran every 12 hours, managed from the regenconf --- data/hooks/conf_regen/01-yunohost | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/data/hooks/conf_regen/01-yunohost b/data/hooks/conf_regen/01-yunohost index 7b9644c2a..5528236cf 100755 --- a/data/hooks/conf_regen/01-yunohost +++ b/data/hooks/conf_regen/01-yunohost @@ -53,6 +53,16 @@ do_pre_regen() { else sudo cp services.yml /etc/yunohost/services.yml fi + + # add cron job for diagnosis to be ran at 7h and 19h + a random delay between + # 0 and 10min, meant to avoid every instances running their diagnosis at + # exactly the same time, which may overload the diagnosis server. + mkdir -p $pending_dir/etc/cron.d/ + cat > $pending_dir/etc/cron.d/yunohost-diagnosis << EOF +SHELL=/bin/bash +0 7,19 * * * root : YunoHost Diagnosis; sleep \$((RANDOM\\%600)); yunohost diagnosis run > /dev/null +EOF + } _update_services() {