ntpd revision 135194
1118652Sache#!/bin/sh 2118652Sache# 3118652Sache# $NetBSD: ntpd,v 1.6 2002/03/22 04:33:59 thorpej Exp $ 4118652Sache# $FreeBSD: head/etc/rc.d/ntpd 135194 2004-09-14 03:01:38Z seanc $ 5118652Sache# 6118652Sache 7118652Sache# PROVIDE: ntpd 8118652Sache# REQUIRE: DAEMON 9118652Sache# BEFORE: LOGIN 10118652Sache# KEYWORD: FreeBSD nojail 11118652Sache 12118652Sache. /etc/rc.subr 13118652Sache 14118652Sachename=ntpd 15118653Sachercvar=`set_rcvar` 16118652Sachecommand="/usr/sbin/${name}" 17118652Sachepidfile="/var/run/${name}.pid" 18118652Sachestart_precmd="ntpd_precmd" 19118652Sacherequired_files="/etc/ntp.conf" 20118652Sache 21118652Sachentpd_precmd() 22118652Sache{ 23118652Sache if checkyesno ntpd_sync_on_start; then 24118652Sache rc_flags="-g ${ntpd_flags}" 25118652Sache fi 26118652Sache 27118652Sache if [ -z "$ntpd_chrootdir" ]; then 28118652Sache return 0; 29118652Sache fi 30118652Sache 31118652Sache # If running in a chroot cage, ensure that the appropriate files 32118652Sache # exist inside the cage, as well as helper symlinks into the cage 33118652Sache # from outside. 34118652Sache # 35118652Sache # As this is called after the is_running and required_dir checks 36118652Sache # are made in run_rc_command(), we can safely assume ${ntpd_chrootdir} 37118652Sache # exists and ntpd isn't running at this point (unless forcestart 38118652Sache # is used). 39118652Sache # 40118652Sache if [ ! -c "${ntpd_chrootdir}/dev/clockctl" ]; then 41118652Sache rm -f "${ntpd_chrootdir}/dev/clockctl" 42118652Sache ( cd /dev ; /bin/pax -rw -pe clockctl "${ntpd_chrootdir}/dev" ) 43118652Sache fi 44118652Sache ln -fs "${ntpd_chrootdir}/var/db/ntp.drift" /var/db/ntp.drift 45118652Sache 46118652Sache # Change run_rc_commands()'s internal copy of $ntpd_flags 47118652Sache # 48118652Sache rc_flags="-u ntpd:ntpd -i ${ntpd_chrootdir} $rc_flags" 49118652Sache} 50118652Sache 51118652Sacheload_rc_config $name 52118652Sacherun_rc_command "$1" 53118652Sache