conf/112604: New file: /etc/periodic/daily/480.status-ntp
Oliver Fromme
olli at secnetix.de
Fri May 11 19:00:11 UTC 2007
>Number: 112604
>Category: conf
>Synopsis: New file: /etc/periodic/daily/480.status-ntp
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Fri May 11 19:00:10 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator: Oliver Fromme
>Release: FreeBSD 6.2-STABLE i386
>Organization:
secnetix GmbH & Co. KG
http://www.secnetix.de/bsd
>Environment:
FreeBSD 6-stable + 7-current
>Description:
The script below adds an optional status report for NTP
to the daily periodic output. It exits with return code 0
if the local ntpd is successfully synchronized. It exits
with return code 1 if the local ntpd is currently not
synchronized, or if ntpd isn't running at all, or if it's
refusing connections from localhost.
>How-To-Repeat:
Save the script below as /etc/periodic/daily/480.status-ntp
and add this line to /etc/periodic.conf:
daily_status_ntp_enable="YES"
Suggested default entry for /etc/defaults/periodic.conf:
# 480.status-ntp
daily_status_ntp_enable="NO" # Check NTP status
>Fix:
#!/bin/sh
#
# $FreeBSD$
#
# If there is a global system configuration file, suck it in.
#
if [ -r /etc/defaults/periodic.conf ]
then
. /etc/defaults/periodic.conf
source_periodic_confs
fi
rc=0
case "$daily_status_ntp_enable" in
[Yy][Ee][Ss])
echo ""
echo "NTP status:"
synchronized=$(ntpq -p | tee /dev/stderr | grep '^\*')
if [ -z "$synchronized" ]; then
rc=1
fi
;;
esac
exit $rc
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list