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