Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Comparing time differences between 2 Solaris servers Post 303023490 by bakunin on Tuesday 18th of September 2018 06:20:53 AM
Old 09-18-2018
Quote:
Originally Posted by Fossil_84
Bakunin, I agree with you more that both servers should be sync to a single time server or setup in a way that it's sync to 2 or more servers. But assuming that there is a good reason that it's done this way (and also I would need lots of approval to reconfigure the servers).
Usually there is no good reason for doing something without a good reason. But that only as an aside. You should indeed investigate, because you likely end up implementing a solution for a non-existing problem. You might also want to tell us the surroundings of your problem:

I suppose you have the two servers in two different data centres and each of these data centres have its own stratum-3-server (is it that way?). This setup makes some sense because when a site disaster happens the other DC will stilll be able to operate on its own including NTP. In this case the question is if these stratum-3-servers aren't getting their time from a single stratum-2 server. If this is the case you need not check it because their time difference will be near zero or zero always. Timekeeping in systems is unreliable indeed but by far good enough so that any network latency which would update one stratum-3 server faster than the other is negligible.

Quote:
Originally Posted by Fossil_84
Would there be any commands/script that I can use to check the time difference between them?
There is the "UNIX time", which is a 32-bit integer value counting the seconds from Jan 1st 1970. You could get that via remote command execution (nowadays usually ssh, but for this the exact method doesn't matter) from the remote machine and the local machine and the it is simply a matter of integer arithmetic.

You will have to check if Solaris date can do the same as GNU date (or maybe GNU utilities are installed on your system - it wouldn't be uncommon) which is output times in RFC-3339 format. An example output would be (GNU date used):

Code:
# date --rfc-3339=ns

2018-09-18 12:12:59.142223794+02:00

Notice that there is a problem getting the time on both servers simultanously if you want to address differences lower than a second. You can never be sure how much of the difference is caused by network trasmission time and how much is because of differing clock times.

I hope this helps.

bakunin
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Working out time differences

Hi everyone, I need to be able to write into a ksh script, a function that can look at 2 24 hour time variables and work out the difference between them. e.g job1 runs at 21:00 job2 runs at 01:00 diff = 04:00 hours I would also need negative numbers i.e where job1 runs after job2 ... (1 Reply)
Discussion started by: rik1551
1 Replies

2. Shell Programming and Scripting

Date/time differences

A thanks to all ahead of time. I've checked previous posts about this subject and can't find any that quite fit what I need. If I've missed the post could you point me there. When I do an ls -al I get the following output: -rw-r--r-- 1 staff staff 855 July 24 20:05 ... (4 Replies)
Discussion started by: gillr
4 Replies

3. Shell Programming and Scripting

comparing file content differences

I need to write a script to find out if there are any .c files created/removed from the last time i monitored the files available. i first created a file to contain all the .c files available on the system. (ls *.c > file1) I created another file using the same command. I used the comm file1... (4 Replies)
Discussion started by: RianTan
4 Replies

4. Solaris

comparing 2 Solaris servers

hello has anyone built a script that compares 2 Solaris servers? CPU, memory, swap, memory variables in /etc/system, Solaris version Could you please advise on how to make such a comparaison? thanks (9 Replies)
Discussion started by: melanie_pfefer
9 Replies

5. UNIX for Dummies Questions & Answers

Differences between time command and usr/bin/time

I wondered if someone could point out the differences between the time commmand and usr/bin/time and the accuracy one might have over another. Also, is there a website or two a person could maybe link for me to describe the differences? Thank you for your time. (2 Replies)
Discussion started by: icedrake
2 Replies

6. Shell Programming and Scripting

Comparing files columnwise and print the differences in third file

Hello Everybody!!!!!!!!! Request you to help me with the below mentioned issue: I have 2 files say, File 1: a|4|7 b|3|2 c|8|8 d|8|9 File 2: a|4|6 b|2|2 c|8|8 d|9|8 The third file(output file) should have: Data mismatch in row 1 column 3 Data mismatch in row 2 coumn 2 Data... (3 Replies)
Discussion started by: abhijeet1409
3 Replies

7. Shell Programming and Scripting

Perl: Comparing to two files and displaying the differences

Hi, I'm new to perl and i have to write a perl script that will compare to log/txt files and display the differences. Unfortunately I'm not allowed to use any complied binaries or applications like diff or comm. So far i've across a code like this: use strict; use warnings; my $list1;... (2 Replies)
Discussion started by: dont_be_hasty
2 Replies

8. Shell Programming and Scripting

Comparing two files and list the differences

Hi * I have two text files which has the file size, timestamp and the file name. I need to compare these two files and get the differences in the output format. Can anyone help me out with this. * cat file1.txt *474742 Apr 18* 2010 sample.log *135098 Apr 18* 2010 Testfile 134282 Apr 18* 2010... (7 Replies)
Discussion started by: Sendhil.Kumaran
7 Replies

9. Shell Programming and Scripting

Help comparing 2 files and sending differences

I have 2 files that need to be compared. Email the differences if something is different and don't email if nothing is different. One or both of the files could be empty. One or both could have data in them. example files backup.doc.$(date +%y%m%d) file size is 0 backup.doc.$(TZ=CST+24... (4 Replies)
Discussion started by: jabbott3
4 Replies

10. Shell Programming and Scripting

Comparing 2 xml files and print the differences only in output

Hi....I'm having 2 xml files, one is having some special characters and another is a clean xml file does not have any special characters. Now I need one audit kind of file which will show me only from which line the special characters have been removed and the special characters. Can you please... (1 Reply)
Discussion started by: Krishanu Saha
1 Replies
ntptrace(1)							   User Commands						       ntptrace(1)

NAME
ntptrace - Trace peers of an NTP server SYNOPSIS
ntptrace [-flags] [-flag [value]] [--option-name[[=| ]value]] [host] DESCRIPTION
ntptrace is a perl script that uses the ntpq utility program to follow the chain of NTP servers from a given host back to the primary time source. For ntptrace to work properly, each of these servers must implement the NTP Control and Monitoring Protocol specified in RFC 1305 and enable NTP Mode 6 packets. If given no arguments, ntptrace starts with localhost. Here is an example of the output from ntptrace: % ntptrace localhost: stratum 4, offset 0.0019529, synch distance 0.144135 server2ozo.com: stratum 2, offset 0.0124263, synch distance 0.115784 usndh.edu: stratum 1, offset 0.0019298, synch distance 0.011993, refid 'WWVB' On each line, the fields are (left to right): the host name, the host stratum, the time offset between that host and the local host (as measured by ntptrace; this is why it is not always zero for "localhost"), the host synchronization distance, and (only for stratum-1 servers) the reference clock ID. All times are given in seconds. Note that the stratum is the server hop count to the primary source, while the synchronization distance is the estimated error relative to the primary source. These terms are precisely defined in RFC-1305. OPTIONS
-n, --numeric Print IP addresses instead of hostnames. Output hosts as dotted-quad numeric format rather than converting to the canonical host names. -m number, --max-hosts=number Maximum number of peers to trace. This option takes an integer number as its argument. The default number for this option is: 99 This option has not been fully documented. -r string, --host=string Single remote host. The default string for this option is: 127.0.0.1 This option has not been fully documented. -?, --help Display usage information and exit. -!, --more-help Pass the extended usage information through a pager. -v [{v|c|n --version [{v|c|n}]}] Output version of program and exit. The default mode is `v', a simple version. The `c' mode will print copyright information and `n' will print the full copyright notice. EXIT STATUS
One of the following exit values will be returned: 0 (EXIT_SUCCESS) Successful program execution. 1 (EXIT_FAILURE) The operation failed or the command syntax was not valid. 70 (EX_SOFTWARE) libopts had an internal operational error. Please report it to autogen-users@lists.sourceforge.net. Thank you. NOTES
This manual page was AutoGen-erated from the ntptrace option definitions. ntp (4.2.8p13) 20 Feb 2019 ntptrace(1)
All times are GMT -4. The time now is 07:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy