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