ntpd revision 1.4
1#!/bin/sh 2# 3# $NetBSD: ntpd,v 1.4 2002/01/18 10:51:30 lukem Exp $ 4# 5 6# PROVIDE: ntpd 7# REQUIRE: DAEMON 8 9. /etc/rc.subr 10 11name="ntpd" 12rcvar=$name 13command="/usr/sbin/${name}" 14pidfile="/var/run/${name}.pid" 15start_precmd="ntpd_precmd" 16required_files="/etc/ntp.conf" 17 18ntpd_precmd() 19{ 20 if [ -z "$ntpd_chrootdir" ]; then 21 return 0; 22 fi 23 24 # If running in a chroot cage, ensure that the appropriate files 25 # exist inside the cage, as well as helper symlinks into the cage 26 # from outside. 27 # 28 # As this is called after the is_running and required_dir checks 29 # are made in run_rc_command(), we can safely assume ${ntpd_chrootdir} 30 # exists and ntpd isn't running at this point (unless forcestart 31 # is used). 32 # 33 if [ ! -c "${ntpd_chrootdir}/dev/clockctl" ]; then 34 rm -f "${ntpd_chrootdir}/dev/clockctl" 35 ( cd /dev ; /bin/pax -rw -pe clockctl "${ntpd_chrootdir}/dev" ) 36 fi 37 ln -fs "${ntpd_chrootdir}/var/db/ntp.drift" /var/db/ntp.drift 38 39 # Change run_rc_commands()'s internal copy of $ntpd_flags 40 # 41 _flags="-u ntpd:ntpd -i ${ntpd_chrootdir} $_flags" 42} 43 44load_rc_config $name 45run_rc_command "$1" 46