ntpd revision 157840
178344Sobrien#!/bin/sh 278344Sobrien# 398184Sgordon# $FreeBSD: head/etc/rc.d/ntpd 157840 2006-04-18 15:02:24Z flz $ 478344Sobrien# 578344Sobrien 678344Sobrien# PROVIDE: ntpd 7153607Sdougb# REQUIRE: DAEMON ntpdate cleanvar devfs 898184Sgordon# BEFORE: LOGIN 9136224Smtm# KEYWORD: nojail 1078344Sobrien 1178344Sobrien. /etc/rc.subr 1278344Sobrien 13101851Sgordonname=ntpd 14101851Sgordonrcvar=`set_rcvar` 15101851Sgordoncommand="/usr/sbin/${name}" 16101851Sgordonpidfile="/var/run/${name}.pid" 17135194Sseancstart_precmd="ntpd_precmd" 18101851Sgordon 19157840Sflzload_rc_config $name 20157840Sflz 21157840Sflzrequired_files="${ntpd_config}" 22157840Sflz 2398184Sgordonntpd_precmd() 2498184Sgordon{ 25157840Sflz rc_flags="-c ${ntpd_config} ${ntpd_flags}" 26157840Sflz 27135194Sseanc if checkyesno ntpd_sync_on_start; then 28157840Sflz rc_flags="-g $rc_flags" 29135194Sseanc fi 30135194Sseanc 3198184Sgordon if [ -z "$ntpd_chrootdir" ]; then 3298184Sgordon return 0; 3398184Sgordon fi 3498184Sgordon 3598184Sgordon # If running in a chroot cage, ensure that the appropriate files 36104980Sschweikh # exist inside the cage, as well as helper symlinks into the cage 3798184Sgordon # from outside. 3898184Sgordon # 3998184Sgordon # As this is called after the is_running and required_dir checks 4098184Sgordon # are made in run_rc_command(), we can safely assume ${ntpd_chrootdir} 4198184Sgordon # exists and ntpd isn't running at this point (unless forcestart 4298184Sgordon # is used). 4398184Sgordon # 4498184Sgordon if [ ! -c "${ntpd_chrootdir}/dev/clockctl" ]; then 4598184Sgordon rm -f "${ntpd_chrootdir}/dev/clockctl" 4698184Sgordon ( cd /dev ; /bin/pax -rw -pe clockctl "${ntpd_chrootdir}/dev" ) 4798184Sgordon fi 4898184Sgordon ln -fs "${ntpd_chrootdir}/var/db/ntp.drift" /var/db/ntp.drift 4998184Sgordon 5098184Sgordon # Change run_rc_commands()'s internal copy of $ntpd_flags 5198184Sgordon # 5298184Sgordon rc_flags="-u ntpd:ntpd -i ${ntpd_chrootdir} $rc_flags" 5398184Sgordon} 5498184Sgordon 5578344Sobrienrun_rc_command "$1" 56