From 55bacd7405b381f21557ae9ef7a5f3cfa4aa2685 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 13 Oct 2021 15:37:39 +0200 Subject: [PATCH] dyndns cron: validate that we're connected to the internet before triggering yunohost dyndns update --- data/hooks/conf_regen/01-yunohost | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/data/hooks/conf_regen/01-yunohost b/data/hooks/conf_regen/01-yunohost index 341efce9e..34679af07 100755 --- a/data/hooks/conf_regen/01-yunohost +++ b/data/hooks/conf_regen/01-yunohost @@ -105,7 +105,12 @@ EOF if ls -l /etc/yunohost/dyndns/K*.private 2>/dev/null; then cat >$pending_dir/etc/cron.d/yunohost-dyndns <> /dev/null +# Every 10 minutes, +# - (sleep random 60 is here to spread requests over a 1-min window) +# - if ip.yunohost.org answers ping (basic check to validate that we're connected to the internet and yunohost infra aint down) +# - and if lock ain't already taken by another command +# - trigger yunohost dyndns update +*/10 * * * * root : YunoHost DynDNS update; sleep \$((RANDOM\\%60)); ! ping -q -W5 -c1 ip.yunohost.org >/dev/null 2>&1 || test -e /var/run/moulinette_yunohost.lock || yunohost dyndns update >> /dev/null EOF fi