summaryrefslogtreecommitdiffstats
path: root/contrib/ntp/scripts/rc/rc.d
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ntp/scripts/rc/rc.d')
-rw-r--r--contrib/ntp/scripts/rc/rc.d/TIMESYNC8
-rw-r--r--contrib/ntp/scripts/rc/rc.d/ntpd32
-rw-r--r--contrib/ntp/scripts/rc/rc.d/ntpwait21
3 files changed, 61 insertions, 0 deletions
diff --git a/contrib/ntp/scripts/rc/rc.d/TIMESYNC b/contrib/ntp/scripts/rc/rc.d/TIMESYNC
new file mode 100644
index 0000000..a8c074f
--- /dev/null
+++ b/contrib/ntp/scripts/rc/rc.d/TIMESYNC
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+# PROVIDE: TIMESYNC
+# REQUIRE: LOGIN ntpwait
+
+# This depedency ensures that all services which require stable system clock
+# are run after ntpd is synchronized. It's run as late as possible, if you need
+# stable clock before login use BEFORE: LOGIN
diff --git a/contrib/ntp/scripts/rc/rc.d/ntpd b/contrib/ntp/scripts/rc/rc.d/ntpd
new file mode 100644
index 0000000..ea33458
--- /dev/null
+++ b/contrib/ntp/scripts/rc/rc.d/ntpd
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+# PROVIDE: ntpd
+# REQUIRE: syslogd cleanvar devfs
+# BEFORE: SERVERS
+
+. /etc/rc.subr
+
+name="ntpd"
+rcvar="ntpd_enable"
+command="/usr/sbin/${name}"
+pidfile="/var/run/${name}.pid"
+start_precmd="ntpd_precmd"
+
+load_rc_config $name
+
+ntpd_precmd()
+{
+ rc_flags="-c ${ntpd_config} ${ntpd_flags}"
+
+ if checkyesno ntpd_sync_on_start; then
+ rc_flags="-g $rc_flags"
+ fi
+
+ if [ -z "$ntpd_chrootdir" ]; then
+ return 0;
+ fi
+
+ rc_flags="-u ntpd:ntpd -i ${ntpd_chrootdir} $rc_flags"
+}
+
+run_rc_command "$1"
diff --git a/contrib/ntp/scripts/rc/rc.d/ntpwait b/contrib/ntp/scripts/rc/rc.d/ntpwait
new file mode 100644
index 0000000..891d0db
--- /dev/null
+++ b/contrib/ntp/scripts/rc/rc.d/ntpwait
@@ -0,0 +1,21 @@
+#!/bin/sh
+# This script, when run, runs ntp-wait if ntpd is enabled.
+
+# PROVIDE: ntpwait
+
+. /etc/rc.subr
+
+name="ntpwait"
+rcvar="ntpwait_enable"
+start_cmd="ntpwait_start"
+ntp_wait="/usr/sbin/ntp-wait"
+
+load_rc_config "$name"
+
+ntpwait_start() {
+ if checkyesno ntpd_enable; then
+ $ntp_wait -v
+ fi
+}
+
+run_rc_command "$1"
OpenPOWER on IntegriCloud