Sponsored Content
Full Discussion: Script to detect time drift
Operating Systems HP-UX Script to detect time drift Post 303017344 by Green_Star on Monday 14th of May 2018 01:21:52 PM
Old 05-14-2018
Thanks rbattle1 for your response.

The user wants us to create a script that runs on the UNIX HP-UX server every 10 min and check for any time drifts >+/- 50 ms. If the time drift is >+/- 50 ms then the script should trigger an email to the user.

I am not quite sure the next steps of the user once they are aware of time drifts.

After talking to couple of DBAs & googling, I understood that if the NTP service runs every 10 minutes on the server, it creates ntp.drift file every time NTP service runs. And ntp.drift contains the offset information and I can use this to calculate time in milli seconds and calculate the time drift. Is this assumption correct?

Please advise. I just want to make sure I am doing the right thing.

Thanks very much in advance.
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how to detect my script is already running

I have a script which must not be run more than once at any given time. THis script will be scheduled to run every 20 mins as a cron job. In my script can i have logic to say if this script is already running from the previous cron, then exit. How do i go about doing that. If you describe the... (11 Replies)
Discussion started by: rmulchandani
11 Replies

2. Shell Programming and Scripting

AWK script to detect webpages from file

Hi guys I'm very new to unix and I have to create an awk script that detects webpage addresses from a file/webpage and outputs how many times each webpage was detected.e.g. if my file was: (Note: The symbol " was added to stop them being created into links) "www.google.com"... (1 Reply)
Discussion started by: ROFL
1 Replies

3. Shell Programming and Scripting

AWK script to detect webpages from file

Hi guys I'm very new to unix and I have to create an awk script that detects webpage addresses from a file/webpage and outputs how many times each webpage was detected.e.g. if my file was: www.google.com www.facebook.com www.google.com the output should be: www.google.com x2... (2 Replies)
Discussion started by: ROFL
2 Replies

4. Shell Programming and Scripting

Detect if script starts from queue

Dear community, what I'm try to do is deny users to run a script without parameters from command bash, but the same script should run without parameters only from crontab. Example runs by crontab:*/5 * * * * /tmp/script.sh Here the normal execution starts every 5 minutes Example #1 runs by... (16 Replies)
Discussion started by: Lord Spectre
16 Replies

5. Shell Programming and Scripting

How to detect Hanged process in shell script?

I have to check daily 20 processes each day. The names are like Network1 Network2 Network3 ....... Network20. There is built in utility for doing this. Following is the command to check a single network process. check_process_status 1 If we want to check the status of Network2 then the... (6 Replies)
Discussion started by: Nakul_sh
6 Replies

6. Shell Programming and Scripting

Help with detect with regex and move script

Hi all, I am needing some help with a script that will search for a video file by known extensions and then do a pattern search (I'm guessing via regex) and then based on a match of one type of another move the file to an assigned directory. I would like to do this with either a shell script... (7 Replies)
Discussion started by: Simplify
7 Replies

7. UNIX for Advanced & Expert Users

A script to detect system type

Hi forum, So I am trying to determine the OS type with the following script: #!/usr/bin/sh OStype1=`uname -s` Sunos1=SunOs if then echo "This system is Linux" exit 0 elif then echo "This system is SunOs" exit 0 elif (1 Reply)
Discussion started by: dampio
1 Replies

8. UNIX for Beginners Questions & Answers

Script to detect time drift on server

Hello there, I am not an expert in networking related stuff but I got a requirement to create UNIX script to query our Company's internal time source via NTP for time drift detect and report it when > +/- 50ms. I have been googling a lot but thought to post it in this forum to get a... (1 Reply)
Discussion started by: Green_Star
1 Replies

9. Shell Programming and Scripting

How to detect url in use in a script?

Hello, I have a small script and it runs from web application in below format: pipe:///path_to_myscript.sh url1 url2 url3 myscript.sh: #!/bin/bash count=0 while do count=$((count+1)) exec 3>&1 ((ffmpeg -i $1 ...... -f mpegts pipe:1 2>/dev/null 1>&3 ) 2>&1 | \ while read LINE; do echo... (9 Replies)
Discussion started by: baris35
9 Replies
ntp(1)							      General Commands Manual							    ntp(1)

NAME
ntp - query a clock running a Network Time Protocol daemon, either ntpd or xntpd SYNOPSIS
/usr/bin/ntp [-v] [-s] [-f] host1 | IPaddress1 ... OPTIONS
Specifies verbose output. The output shows the full contents of the received NTP packets, plus the calculated offset and delay. Sets local clock to remote time. This only happens if the offset between the local and remote time is less than 1000 seconds. The local clock is not reset if the remote host is unsynchronized. If you specify more than one host name on the command line, ntp queries each host in order, waiting for each host to answer or time- out before querying the next host. The local clock is set to the time of the first remote host that responds. Forces setting local clock regardless of offset. The -f option must be used with -s option. The local clock is not reset if the remote host is unsyn- chronized. DESCRIPTION
The ntp command may be retired in a future release; use the ntpdate(8) command instead. The ntp command is used to determine the offset between the local clock and a remote clock. It can also be used to set the local host's time to a remote host's time. The ntp command sends an NTP packet to the NTP daemon running on each of the remote hosts specified on the command line. The remote hosts must be running either the ntpd daemon or xntpd daemon. When the NTP daemon on the remote host receives the NTP packet, it fills in the fields (as specified in RFC 1129), and sends the packet back. The ntp command then formats and prints the results on the standard output. Note You can specify hosts by either host name or Internet address. The hosts that you specify must either exist in the /etc/hosts file, or in the master hosts database, if the database is being served to your system by BIND or Network Information Service (NIS). The default output shows the roundtrip delay of the NTP packet in seconds, the estimated offset between the local time and remote time in seconds, and the date in ctime format. See the ctime(3) reference page for more information. The -s and -f options can be used to reset the time of the local clock. RESTRICTIONS
Using the -s and -f options require that you be logged on as superuser. ERRORS
The following error messages can be returned by NTP: May indicate that the NTP daemon is not running on the remote host. The NTP command cannot resolve the specified host name in the /etc/hosts file. Check that the host exists in the /etc/hosts file, or that it exists in the master hosts database, if the database is being served to your system by BIND or NIS. EXAMPLES
In the following examples, some output text lines may be broken. The line end are marked with the backslash symbol () and the following line is indented. Such text may appear as a single line on your terminal. The following is the default output to an ntp query about a remote host with an internet address of 555.5.55.5: # /usr/bin/ntp 555.5.55.5 555.5.55.5: delay:1.845207 offset:-0.358460 Mon Aug 20 08:05:44 1991 The following is the verbose output to an ntp query about the same remote host: # /usr/bin/ntp -v 555.5.55.5 Packet from: [555.5.55.5] Leap 0, version 1, mode Server, poll 6, precision -10 stratum 1 (WWVB) Synch Distance is 0000.1999 0.099991 Synch Dispersion is 0000.0000 0.000000 Reference Timestamp is a7bea6c3.88b40000 Tue Aug 20 14:06:43 1991 Originate Timestamp is a7bea6d7.d7e6e652 Tue Aug 20 14:07:03 1991 Receive Timestamp is a7bea6d7.cf1a0000 Tue Aug 20 14:07:03 1991 Transmit Timestamp is a7bea6d8.0ccc0000 Tue Aug 20 14:07:04 1991 Input Timestamp is a7bea6d8.1a77e5ea Tue Aug 20 14:07:04 1991 555.5.55.5: delay:0.019028 offset:-0.043890 Tue Aug 20 14:07:04 1991 The fields are interpreted as follows: The address of the remote host from which this NTP packet was received. The leap second indicator. Non-zero if there is to be a leap second inserted in the NTP timescale. The bits are set before 23:59 on the day of insertion and reset after 00:00 on the following day. The NTP protocol version. The NTP mode can be Server, Client, Symmetric Pas- sive, Symmetric Active, or Broadcast. See RFC 1129 for more information on NTP modes. The desired poll rate of the peer in seconds as a power of 2. For example, if poll is equal to 6, that means that the poll rate is one message exchanged every 2**6 seconds. The precision of the remote host's clock in seconds as a power of 2. For example, if precision is equal to -10, that means that the pre- cision is 2**-10. The NTP daemon sets this automatically. The stratum of the clock in the NTP hierarchy, along with the source of the clock. The source is either the name of a reference standard (such as WWVB or GOES), or the Internet address of the clock that this clock references. The values reported are used internally by the NTP daemon. The values reported are used internally by the NTP daemon. The next five timestamps are given as NTP fixed-point values, in both hexadecimal and ctime. The timestamps are set either by this NTP process, or by the remote host you are querying. These timestamps are used by the local host to calculate delay and offset for this query. This specifies the last time the remote host clock was adjusted. (remote time) This specifies when the NTP request was transmitted by the local host to the remote host. (local time) This specifies when the NTP request was received at the remote host. (remote time) This specifies when the NTP response was transmitted by the remote host. (remote time) This specifies when the NTP response was received by the local host. (local time) This field summarizes the results of the query, giving the host name or inter- net address of the responding clock specified in the command line, the round-trip delay in seconds, and the offset between the two clocks in seconds (assuming symmetric round-trip times). SEE ALSO
ctime(3), ntp.conf(4), ntpdate(8), xntpd(8), xntpdc(8), ntpq(8) Internet time synchronization: The Network Time Protocol (RFC 1129) Network Administration ntp(1)
All times are GMT -4. The time now is 02:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy