Changeset View
Changeset View
Standalone View
Standalone View
libexec/rc/rc.d/ntpd
#!/bin/sh | #!/bin/sh | ||||
# | # | ||||
# $FreeBSD$ | # $FreeBSD$ | ||||
# | # | ||||
# PROVIDE: ntpd | # PROVIDE: ntpd | ||||
# REQUIRE: DAEMON ntpdate FILESYSTEMS devfs | # REQUIRE: DAEMON ntpdate FILESYSTEMS devfs | ||||
# BEFORE: LOGIN | # BEFORE: LOGIN | ||||
# KEYWORD: nojail shutdown | # KEYWORD: nojail resume shutdown | ||||
. /etc/rc.subr | . /etc/rc.subr | ||||
name="ntpd" | name="ntpd" | ||||
desc="Network Time Protocol daemon" | desc="Network Time Protocol daemon" | ||||
rcvar="ntpd_enable" | rcvar="ntpd_enable" | ||||
command="/usr/sbin/${name}" | command="/usr/sbin/${name}" | ||||
extra_commands="fetch needfetch" | extra_commands="fetch needfetch resume" | ||||
fetch_cmd="ntpd_fetch_leapfile" | fetch_cmd="ntpd_fetch_leapfile" | ||||
needfetch_cmd="ntpd_needfetch_leapfile" | needfetch_cmd="ntpd_needfetch_leapfile" | ||||
resume_cmd="ntpd_resume" | |||||
start_precmd="ntpd_precmd" | start_precmd="ntpd_precmd" | ||||
_ntp_tmp_leapfile="/var/run/ntpd.leap-seconds.list" | _ntp_tmp_leapfile="/var/run/ntpd.leap-seconds.list" | ||||
_ntp_default_dir="/var/db/ntp" | _ntp_default_dir="/var/db/ntp" | ||||
_ntp_default_driftfile="${_ntp_default_dir}/ntpd.drift" | _ntp_default_driftfile="${_ntp_default_dir}/ntpd.drift" | ||||
_ntp_old_driftfile="/var/db/ntpd.drift" | _ntp_old_driftfile="/var/db/ntpd.drift" | ||||
pidfile="${_ntp_default_dir}/${name}.pid" | pidfile="${_ntp_default_dir}/${name}.pid" | ||||
▲ Show 20 Lines • Show All 204 Lines • ▼ Show 20 Lines | if [ "$ntp_expiry_tmp" -gt "$ntp_expiry_db" -o \ | ||||
"$ntp_ver_no_tmp" -gt "$ntp_ver_no_db" ]; then | "$ntp_ver_no_tmp" -gt "$ntp_ver_no_db" ]; then | ||||
$verbose using $url as $ntp_db_leapfile | $verbose using $url as $ntp_db_leapfile | ||||
mv -f $_ntp_tmp_leapfile $ntp_db_leapfile || | mv -f $_ntp_tmp_leapfile $ntp_db_leapfile || | ||||
$verbose "warning: cannot replace $ntp_db_leapfile (read-only fs?)" | $verbose "warning: cannot replace $ntp_db_leapfile (read-only fs?)" | ||||
else | else | ||||
$verbose using existing $ntp_db_leapfile | $verbose using existing $ntp_db_leapfile | ||||
fi | fi | ||||
fi | fi | ||||
} | |||||
ntpd_resume() | |||||
{ | |||||
run_rc_command restart | |||||
} | } | ||||
run_rc_command "$1" | run_rc_command "$1" |