From 0a32c83652b4fb07cdbfcb3c0ba89bc0fd8dc242 Mon Sep 17 00:00:00 2001 From: Max Date: Sun, 5 Feb 2023 19:48:20 +0100 Subject: [PATCH] [ClockSync] add support for linux root users and docker --- octobot_commons/os_clock_sync.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/octobot_commons/os_clock_sync.py b/octobot_commons/os_clock_sync.py index e09c726e..63f5cf19 100644 --- a/octobot_commons/os_clock_sync.py +++ b/octobot_commons/os_clock_sync.py @@ -39,11 +39,13 @@ def _get_sync_cmd(self): platform = os_util.get_os() bot_type = os_util.get_octobot_type() if bot_type == commons_enums.OctoBotTypes.DOCKER.value: - raise NotImplementedError(bot_type) + return "service ntp stop && ntpd -gq && service ntp start" if platform is commons_enums.PlatformsName.WINDOWS: # use 2x w32tm /resync as the 1st one often fails return "net stop w32time && net start w32time && w32tm /resync & w32tm /resync && w32tm /query /status" if platform is commons_enums.PlatformsName.LINUX: + if os_util.has_admin_rights(): + return "service ntp stop && ntpd -gq && service ntp start" return "sudo service ntp stop && sudo ntpd -gq && sudo service ntp start" if platform is commons_enums.PlatformsName.MAC: raise NotImplementedError(platform.value)