| 1 | #! /bin/sh -e |
| 2 | |
| 3 | if [ ! -x /usr/sbin/ntpc ]; then exit 0; fi |
| 4 | |
| 5 | ntpdc -c peers | { |
| 6 | any=nil |
| 7 | while read remote local st poll reach delay offset disp; do |
| 8 | case "$remote" in |
| 9 | \**) ;; |
| 10 | *) continue ;; |
| 11 | esac |
| 12 | awk -v off="$offset" 'BEGIN { |
| 13 | if (off < 0) off = -off; |
| 14 | if (off >= 0.1) printf "W: absolute time offset %gs worrying\n", off; |
| 15 | else if (off >= 0.01) printf "I: absolute time offset %gs concerning\n", off; |
| 16 | }' |
| 17 | any=t |
| 18 | done |
| 19 | case $any in |
| 20 | nil) echo "W: not sychronized to any peer" ;; |
| 21 | esac |
| 22 | } |