#!/bin/ksh
# $Id$
# vim:set ts=2 sw=2 et ai:
# monitor the interval between "when" and "poll", sleep until they are expected
# to be updated
SLEEPTIME=0
IFS=''
while sleep $(($SLEEPTIME+1)); do
BUF=`ntpq -p`
echo $BUF
SLEEPTIME=`echo $BUF | awk '
BEGIN {
# 1 minute sleep if we cant find anything
rv = 60
}
$5 ~ /^[0-9]+$/ && $6 ~ /^[0-9]+$/ {
if ($6 - $5 < rv && $6 - $5 > 0) {
rv = $6 - $5
}
}
END {
print rv
}'`
echo "; next query expected in $SLEEPTIME seconds"
done
Monday, July 12, 2010
monitoring ntpd's status
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment