3 # $NetBSD: ntpd,v 1.12 2004/03/31 18:01:07 fredb Exp $
11 $_rc_subr_loaded .
/etc
/rc.subr
15 command="/usr/sbin/${name}"
16 pidfile
="/var/run/${name}.pid"
17 start_precmd
="ntpd_precmd"
18 required_files
="/etc/ntp.conf"
22 if [ -z "$ntpd_chrootdir" ]; then
26 # If running in a chroot cage, ensure that the appropriate files
27 # exist inside the cage, as well as helper symlinks into the cage
30 # As this is called after the is_running and required_dir checks
31 # are made in run_rc_command(), we can safely assume ${ntpd_chrootdir}
32 # exists and ntpd isn't running at this point (unless forcestart
35 # Before enabling ntpd_chrootdir, ensure that:
36 # - The kernel has "pseudo-device clockctl" compiled in
37 # - /dev/clockctl is present
39 if (: </dev
/clockctl
) 2>/dev
/null
; then
42 logger
-s -p daemon.warning
-t ntpd \
43 "WARNING: not chrooting -- no working /dev/clockctl device"
46 if [ ! -c "${ntpd_chrootdir}/dev/clockctl" ]; then
47 rm -f "${ntpd_chrootdir}/dev/clockctl"
48 ( cd /dev
; /bin
/pax
-rw -pe clockctl
"${ntpd_chrootdir}/dev" )
50 ln -fs "${ntpd_chrootdir}/var/db/ntp.drift" /var
/db
/ntp.drift
52 # Change run_rc_commands()'s internal copy of $ntpd_flags
54 rc_flags
="-u ntpd:ntpd -i ${ntpd_chrootdir} $rc_flags"