From 17e198db3a69b854e5745bbd4a0628853f3d8702 Mon Sep 17 00:00:00 2001 From: Antoine Prieels Date: Wed, 1 Jul 2020 11:13:14 +0000 Subject: [PATCH] [FIX] hw_drivers: Synchronize time before starting Odoo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some features need the time to be synchronized before starting: - A certificate might be considered valid and therefore not renewed if the time is not synced. - If the time is not correct when the pairing code is retrieved, it will disappear as soon as the time is synced because more than 5 minutes will have "passed" since the code was retrieved. We then make sure that the time is synced, or that the box is not connected to the internet (because in this case the time will never be synced and those features cannot work with a connection anyway). closes odoo/odoo#53953 X-original-commit: b9b02dba67cd0a91b8c49a5f57fb2f7eb4bdd690 Signed-off-by: Quentin Lejeune (qle) Signed-off-by: Antoine Prieƫls --- .../tools/posbox/overwrite_before_init/etc/init.d/odoo | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/point_of_sale/tools/posbox/overwrite_before_init/etc/init.d/odoo b/addons/point_of_sale/tools/posbox/overwrite_before_init/etc/init.d/odoo index f2f4abfea20..8b346ec8dcb 100755 --- a/addons/point_of_sale/tools/posbox/overwrite_before_init/etc/init.d/odoo +++ b/addons/point_of_sale/tools/posbox/overwrite_before_init/etc/init.d/odoo @@ -26,6 +26,11 @@ test -x $DAEMON || exit 0 set -e function _start() { + # Wait for time to be synced or AP to start or max 30 seconds + cnt=30 + while ! test -a /run/systemd/timesync/synchronized && ! ip route | grep 10.11.12.1 && ((cnt--)); do + sleep 1 + done start-stop-daemon --start --quiet --pidfile $PIDFILE --chuid $USER:$USER --background --make-pidfile --exec $DAEMON -- --config $CONFIG --logfile $LOGFILE --load=web,hw_proxy,hw_posbox_homepage,hw_escpos,hw_drivers --limit-time-cpu=600 --limit-time-real=1200 }