Re: [chrony-users] Request: Add an optional timeout option for 'chronyd -q ...'

2016-12-02 Thread Miroslav Lichvar
On Thu, Dec 01, 2016 at 07:07:53AM -0600, Lonnie Abelbeck wrote:
> > How about returning 0 if the clock was in a synchronised state (the
> > reference was updated at least once) and 1 if not? With -q that would
> > be 0 only if the clock was stepped.
> 
> Yes, that would work for our situation.
> 
> For example using "chronyd -q -u ntp -t 10", if after 5 seconds the clock was 
> in a synchronized state, it steps the clock and exits 0.  Alternatively if 
> after 10 seconds the clock was not yet in a synchronized state, it would exit 
> with a non-zero (timeout) return.

The -t option is now in git. If you test it, please let me know if it
works for you as expected.

-- 
Miroslav Lichvar

-- 
To unsubscribe email chrony-users-requ...@chrony.tuxfamily.org 
with "unsubscribe" in the subject.
For help email chrony-users-requ...@chrony.tuxfamily.org 
with "help" in the subject.
Trouble?  Email listmas...@chrony.tuxfamily.org.



Re: [chrony-users] Request: Add an optional timeout option for 'chronyd -q ...'

2016-12-02 Thread Miroslav Lichvar
On Fri, Dec 02, 2016 at 09:32:35AM -0600, Lonnie Abelbeck wrote:
> On Dec 2, 2016, at 7:57 AM, Miroslav Lichvar  wrote:
> > The -t option is now in git. If you test it, please let me know if it
> > works for you as expected.
> 
> Works perfectly !

Great.

> You will want to add the -t option to the Usage:
> --
> } else if (!strcmp("-h", *argv) || !strcmp("--help", *argv)) {
> - printf("Usage: %s [-4|-6] [-n|-d] [-q|-Q] [-r] [-R] [-s] [-f 
> FILE|COMMAND...]\n",
> + printf("Usage: %s [-4|-6] [-n|-d] [-q|-Q] [-r] [-R] [-s] [-t secs] [-f 
> FILE|COMMAND...]\n",
> --

Thanks, I'll do that.

-- 
Miroslav Lichvar

-- 
To unsubscribe email chrony-users-requ...@chrony.tuxfamily.org 
with "unsubscribe" in the subject.
For help email chrony-users-requ...@chrony.tuxfamily.org 
with "help" in the subject.
Trouble?  Email listmas...@chrony.tuxfamily.org.



Re: [chrony-users] Request: Add an optional timeout option for 'chronyd -q ...'

2016-12-02 Thread Lonnie Abelbeck

On Dec 2, 2016, at 7:57 AM, Miroslav Lichvar  wrote:

> On Thu, Dec 01, 2016 at 07:07:53AM -0600, Lonnie Abelbeck wrote:
>>> How about returning 0 if the clock was in a synchronised state (the
>>> reference was updated at least once) and 1 if not? With -q that would
>>> be 0 only if the clock was stepped.
>> 
>> Yes, that would work for our situation.
>> 
>> For example using "chronyd -q -u ntp -t 10", if after 5 seconds the clock 
>> was in a synchronized state, it steps the clock and exits 0.  Alternatively 
>> if after 10 seconds the clock was not yet in a synchronized state, it would 
>> exit with a non-zero (timeout) return.
> 
> The -t option is now in git. If you test it, please let me know if it
> works for you as expected.

Works perfectly !

You will want to add the -t option to the Usage:
--
} else if (!strcmp("-h", *argv) || !strcmp("--help", *argv)) {
- printf("Usage: %s [-4|-6] [-n|-d] [-q|-Q] [-r] [-R] [-s] [-f 
FILE|COMMAND...]\n",
+ printf("Usage: %s [-4|-6] [-n|-d] [-q|-Q] [-r] [-R] [-s] [-t secs] [-f 
FILE|COMMAND...]\n",
--

I'm thinking " -t 8 " will be our production value.  Typically it takes 4.5 to 
5.5 seconds for most any pool server.
--
chronyd -q -t 8 'server pool.ntp.org iburst'
--

Lonnie


--
To unsubscribe email chrony-users-requ...@chrony.tuxfamily.org
with "unsubscribe" in the subject.
For help email chrony-users-requ...@chrony.tuxfamily.org
with "help" in the subject.
Trouble?  Email listmas...@chrony.tuxfamily.org.