Re: how to force chronyd to be online after booting
Dieter Deyke <dieter.deyke@gmail.com> writes:
>> On 09/26/2014 06:31 PM, lee wrote:
>>> is there an easy way to force chronyd to get into/remain in its online
>>> mode rather than going into offline mode?
>
> I had the same problem. My workaround was to run the following python
> script from /etc/cron.hourly/
>
> #! /usr/bin/env python
>
> import os
> import time
>
> def main():
> chronyd_running = False
> for line in os.popen("ps -ef", "r").readlines():
> if "/usr/sbin/chronyd" in line:
> chronyd_running = True
> sources_ok = False
> if chronyd_running:
> for line in os.popen("chronyc sources", "r").readlines():
> if line.startswith("^") and "10y" not in line:
> sources_ok = True
> if not sources_ok:
> os.system("/etc/init.d/chrony stop")
> time.sleep(3)
> os.system("/etc/init.d/chrony start")
>
> if __name__ == "__main__": main()
Thank you, that should work fine :)
Apparently more recent versions of chrony don't go offline like older
versions do, i. e. they automatically retry to reach the servers in
increasing time intervals.
--
Hallowed are the Debians!
Reply to: