summaryrefslogtreecommitdiff
path: root/net-misc/chrony/files
diff options
context:
space:
mode:
Diffstat (limited to 'net-misc/chrony/files')
-rw-r--r--net-misc/chrony/files/chrony-2.2.logrotate7
-rw-r--r--net-misc/chrony/files/chrony-2.4-r1.logrotate7
-rw-r--r--net-misc/chrony/files/chronyd.conf12
-rw-r--r--net-misc/chrony/files/chronyd.init65
-rw-r--r--net-misc/chrony/files/chronyd.init-r169
-rw-r--r--net-misc/chrony/files/chronyd.service-r212
6 files changed, 172 insertions, 0 deletions
diff --git a/net-misc/chrony/files/chrony-2.2.logrotate b/net-misc/chrony/files/chrony-2.2.logrotate
new file mode 100644
index 000000000000..ae76c8de6af6
--- /dev/null
+++ b/net-misc/chrony/files/chrony-2.2.logrotate
@@ -0,0 +1,7 @@
+/var/log/chrony/*.log {
+ missingok
+ sharedscripts
+ postrotate
+ /usr/bin/chronyc cyclelogs
+ endscript
+}
diff --git a/net-misc/chrony/files/chrony-2.4-r1.logrotate b/net-misc/chrony/files/chrony-2.4-r1.logrotate
new file mode 100644
index 000000000000..a2cf8feb5b77
--- /dev/null
+++ b/net-misc/chrony/files/chrony-2.4-r1.logrotate
@@ -0,0 +1,7 @@
+/var/log/chrony/*.log {
+ missingok
+ sharedscripts
+ postrotate
+ /usr/bin/chronyc cyclelogs |grep -v '^200 OK'; exit 0
+ endscript
+}
diff --git a/net-misc/chrony/files/chronyd.conf b/net-misc/chrony/files/chronyd.conf
new file mode 100644
index 000000000000..fc43a95c40fe
--- /dev/null
+++ b/net-misc/chrony/files/chronyd.conf
@@ -0,0 +1,12 @@
+# /etc/conf.d/chronyd
+
+CFGFILE="/etc/chrony/chrony.conf"
+
+# Configuration dependant options :
+# -s - Set system time from RTC if rtcfile directive present
+# -r - Reload sample histories if dumponexit directive present
+#
+# The combination of "-s -r" allows chronyd to perform long term averaging of
+# the gain or loss rate across system reboots and shutdowns.
+
+ARGS=""
diff --git a/net-misc/chrony/files/chronyd.init b/net-misc/chrony/files/chronyd.init
new file mode 100644
index 000000000000..3a71fe748fd7
--- /dev/null
+++ b/net-misc/chrony/files/chronyd.init
@@ -0,0 +1,65 @@
+#!/sbin/openrc-run
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ use dns
+}
+
+checkconfig() {
+ # Note that /etc/chrony/chrony.keys is *NOT* checked. This
+ # is because the user may have specified another key
+ # file, and we don't want to force the user to use that
+ # exact name for the key file.
+ if [ ! -f "${CFGFILE}" ] ; then
+ eerror "Please create ${CFGFILE} and the"
+ eerror "chrony key file (usually /etc/chrony/chrony.keys)"
+ eerror "by using the"
+ eerror ""
+ eerror " chrony.conf.example"
+ eerror " chrony.keys.example"
+ eerror ""
+ eerror "files (from the documentation directory)"
+ eerror "as templates."
+ return 1
+ else
+ # Actually, I tried it, and chrony seems to ignore the pidfile
+ # option. I'm going to leave it here anyway, since you never
+ # know if it might be handy
+ PIDFILE=`awk '/^ *pidfile/{print $2}' "${CFGFILE}"`
+ fi
+ return 0
+}
+
+setxtrarg() {
+ if [ -c /dev/rtc ]; then
+ grep -q '^rtcfile' "${CFGFILE}" && ARGS="${ARGS} -s"
+ fi
+ grep -q '^dumponexit$' "${CFGFILE}" && ARGS="${ARGS} -r"
+ return 0
+}
+
+start() {
+ checkconfig || return $?
+ setxtrarg
+
+ [ -n "${PIDFILE}" ] || PIDFILE=/run/chronyd.pid
+
+ ebegin "Starting chronyd"
+ start-stop-daemon --start --background --quiet \
+ --exec /usr/sbin/chronyd \
+ --pidfile "${PIDFILE}" \
+ -- -f "${CFGFILE}" ${ARGS}
+ eend $? "Failed to start chronyd"
+}
+
+stop() {
+ checkconfig || return $?
+
+ [ -n "${PIDFILE}" ] || PIDFILE=/run/chronyd.pid
+
+ ebegin "Stopping chronyd"
+ start-stop-daemon --stop --quiet \
+ --pidfile "${PIDFILE}"
+ eend $? "Failed to stop chronyd"
+}
diff --git a/net-misc/chrony/files/chronyd.init-r1 b/net-misc/chrony/files/chronyd.init-r1
new file mode 100644
index 000000000000..a76e2533f57d
--- /dev/null
+++ b/net-misc/chrony/files/chronyd.init-r1
@@ -0,0 +1,69 @@
+#!/sbin/openrc-run
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ use dns
+}
+
+checkconfig() {
+ # Note that /etc/chrony/chrony.keys is *NOT* checked. This
+ # is because the user may have specified another key
+ # file, and we don't want to force the user to use that
+ # exact name for the key file.
+ if [ ! -f "${CFGFILE}" ] ; then
+ eerror "Please create ${CFGFILE} and the"
+ eerror "chrony key file (usually /etc/chrony/chrony.keys)"
+ eerror "by using the"
+ eerror ""
+ eerror " chrony.conf.example"
+ eerror " chrony.keys.example"
+ eerror ""
+ eerror "files (from the documentation directory)"
+ eerror "as templates."
+ return 1
+ else
+ # Actually, I tried it, and chrony seems to ignore the pidfile
+ # option. I'm going to leave it here anyway, since you never
+ # know if it might be handy
+ PIDFILE=`awk '/^ *pidfile/{print $2}' "${CFGFILE}"`
+ fi
+ return 0
+}
+
+setxtrarg() {
+ if [ -c /dev/rtc ]; then
+ grep -q '^rtcfile' "${CFGFILE}" && ARGS="${ARGS} -s"
+ fi
+ grep -q '^dumponexit$' "${CFGFILE}" && ARGS="${ARGS} -r"
+ return 0
+}
+
+start() {
+ checkconfig || return $?
+ setxtrarg
+
+ [ -n "${PIDFILE}" ] || PIDFILE=/run/chronyd.pid
+
+ ebegin "Starting chronyd"
+ start-stop-daemon \
+ --start \
+ --quiet \
+ --exec /usr/sbin/chronyd \
+ --pidfile "${PIDFILE}" \
+ -- -f "${CFGFILE}" ${ARGS}
+ eend $? "Failed to start chronyd"
+}
+
+stop() {
+ checkconfig || return $?
+
+ [ -n "${PIDFILE}" ] || PIDFILE=/run/chronyd.pid
+
+ ebegin "Stopping chronyd"
+ start-stop-daemon \
+ --stop \
+ --quiet \
+ --pidfile "${PIDFILE}"
+ eend $? "Failed to stop chronyd"
+}
diff --git a/net-misc/chrony/files/chronyd.service-r2 b/net-misc/chrony/files/chronyd.service-r2
new file mode 100644
index 000000000000..90255675c838
--- /dev/null
+++ b/net-misc/chrony/files/chronyd.service-r2
@@ -0,0 +1,12 @@
+[Unit]
+Description=Chrony Network Time Service
+After=ntpdate.service sntp.service network.target
+Conflicts=ntpd.service systemd-timesyncd.service
+
+[Service]
+Type=forking
+ExecStart=/usr/sbin/chronyd
+PIDFile=/run/chronyd.pid
+
+[Install]
+WantedBy=multi-user.target