Thanks a lot Bakunin. That really helps me understand the background!!!
---------- Post updated at 11:52 AM ---------- Previous update was at 09:57 AM ----------
Quote:
Originally Posted by MadeInGermany
Looks like the "ntpq -c rl" changes with every update of the NTP package.
Take the "ntpq -pn" output instead! To be processed like this in the shell script:
Just wondering what would be the value of "offset" using "ntpq -pn" if NTP service is down? Will it be 0 or BLANK?
Command "awk" will print the 9th value of the output "ntpq -pn". So just wondering if NTP service is down, and the offset is BLANK, awk will print "disp" value to the output variable instead of BLANK. Thanks for your time.
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)
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)
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)
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)
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)
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)
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)
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)
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
LEARN ABOUT LINUX
ntpq
NTPQ(1) General Commands Manual NTPQ(1)NAME
ntpq - standard NTP query program
SYNOPSIS
ntpq [-inp] [-c command] [host] [...]
DESCRIPTION
The ntpq utility program is used to monitor NTP daemon ntpd operations and determine performance. It uses the standard NTP mode 6 control
message formats defined in Appendix B of the NTPv3 specification RFC1305. The same formats are used in NTPv4, although some of the vari-
ables have changed and new ones added. The description on this page is for the NTPv4 variables.
The program can be run either in interactive mode or controlled using command line arguments. Requests to read and write arbitrary vari-
ables can be assembled, with raw and pretty-printed output options being available. The ntpq can also obtain and print a list of peers in a
common format by sending multiple queries to the server.
If one or more request options is included on the command line when ntpq is executed, each of the requests will be sent to the NTP servers
running on each of the hosts given as command line arguments, or on localhost by default. If no request options are given, ntpq will
attempt to read commands from the standard input and execute these on the NTP server running on the first host given on the command line,
again defaulting to localhost when no other host is specified. ntpq will prompt for commands if the standard input is a terminal device.
ntpq uses NTP mode 6 packets to communicate with the NTP server, and hence can be used to query any compatible server on the network which
permits it. Note that since NTP is a UDP protocol this communication will be somewhat unreliable, especially over large distances in terms
of network topology. ntpq makes one attempt to retransmit requests, and will time requests out if the remote host is not heard from within
a suitable timeout time.
Note that in contexts where a host name is expected, a -4 qualifier preceding the host name forces DNS resolution to the IPv4 namespace,
while a -6 qualifier forces DNS resolution to the IPv6 namespace.
OPTIONS
Command line options are described following. Specifying a command line option other than -i or -n will cause the specified query (queries)
to be sent to the indicated host(s) immediately. Otherwise, ntpq will attempt to read interactive format commands from the standard input.
-4 Force DNS resolution of following host names on the command line to the IPv4 namespace.
-6 Force DNS resolution of following host names on the command line to the IPv6 namespace.
-c The following argument is interpreted as an interactive format command and is added to the list of commands to be executed on the
specified host(s). Multiple -c options may be given.
-i Force ntpq to operate in interactive mode. Prompts will be written to the standard output and commands read from the standard input.
-n Output all host addresses in dotted-quad numeric format rather than converting to the canonical host names.
-p Print a list of the peers known to the server as well as a summary of their state. This is equivalent to the peers interactive com-
mand.
SEE ALSO
/usr/share/doc/ntp-doc/html/ntpq.html for the full documentation.
Network Time Protocol November 9, 2007 NTPQ(1)