Skip to content

Commit

Permalink
[ClockSync] add support for linux root users and docker
Browse files Browse the repository at this point in the history
  • Loading branch information
techfreaque committed Feb 10, 2023
1 parent d92a400 commit 0a32c83
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion octobot_commons/os_clock_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0a32c83

Please sign in to comment.