main/chrony: add FAST_STARTUP option to OpenRC services

chronyd takes quite some time to perform a double fork to deamonize,
thereby blocking OpenRC. This is probably the case because it blocks
until time is synchronized.

When enabled the FAST_STARTUP option performs the double fork through
start-stop-daemon(1) thereby significantly reducing the startup of the
chronyd service.
This commit is contained in:
Sören Tempel 2018-10-12 12:28:19 +02:00
parent a6a5eb50ee
commit f404cbdcff
3 changed files with 15 additions and 4 deletions

View File

@ -3,7 +3,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=chrony
pkgver=3.3
pkgrel=0
pkgrel=1
_ver=${pkgver/_/-}
pkgdesc="NTP client and server programs"
url="https://chrony.tuxfamily.org"
@ -84,8 +84,8 @@ package() {
sha512sums="36975d863599141e8e5b071d35cf67326b27f5b0da7ec942dbb4530377d10472b0729eea632e0702718b515cb2d5fd41a7eba158e6dade7f05adfb1bdffa5df0 chrony-3.3.tar.gz
067d47224a8c075ec8f63ffc58e65b030fdf228a72c4f03d50a2f2c17414da65bb5d27c7c2e4ba99e909f452041db83eaebe3c9e34c0c8fce18e05ebb489735e fix-tests.patch
b26581ed32680585edea5b8163a0062a87f648394c0f363c77a7d01a36608fcf4d005d9e6ab179ed2827b8a08f598f7bad4801bb5e135cad5107eb77fb19b247 max_resolve_interval.patch
6919c7bddce2a8f81c0f2759c7c58506e97f89102bfeb7b5c19c6da5ed4cbd9070faddd4f3fb411bb4c653fffbdcc93a7f7dc810f38b199f038b1d4072f57640 chronyd.confd
9a18c9744d7b78d9b9be3f0ae0b43cb988b294c342764802e0d5df835d450e748584c0b345f7161f14d84e15c8bbd491514ee9dc45e4a65f1276c52124d2e312 chronyd.initd
0490770cc214b4ccf76470420e0b33e6c41ad16344d6503973a28346b002e2cee441e9ae982be1a8f21696da26f436f2ce36a5201e9628becb83bad3487d9170 chronyd.confd
6139e6464986b82d8c20aee1cda337eae851c318d9f3fe9aee15dc48f2165f9f68ce2e22dcd8018b8fb4e0e1934990c5351e1c3a02d79005e1a1acd8cd02dc0a chronyd.initd
ab38f06bf45888846778ad935e24abb30d13b6805e9a750bc694ff953695fa8c5b33aac560f5f7f96dc46031c1a38660e5c418b6fce6fb34a87908a9a3c99357 chrony.logrotate
0ae453fca3461b6e56a32a9eb6be0d448c39bf0279583222ab2fecef307e1113f082d4e86f957e4baac4f223c5c57804cdea97322678009f3413ab99d54694b6 chrony.conf
eb11fc19243d1789016d88eb7645bfe67c46304547781489bf36eb1dd4c252d523681ff835a6488fa0ef62b6b9e2f781c672279f4439f5d5640a3f214a113048 timepps.h"

View File

@ -2,6 +2,11 @@
CFGFILE="/etc/chrony/chrony.conf"
# chronyd takes some time to perform a second fork, by enabling this
# option chronyd is deamonized through start-stop-daemon(1) thereby
# significantly reducing the startup time.
FAST_STARTUP=no
# Configuration dependant options :
# -s - Set system time from RTC if rtcfile directive present
# -r - Reload sample histories if dumponexit directive present

View File

@ -51,8 +51,14 @@ start() {
[ -n "${PIDFILE}" ] || PIDFILE=/var/run/chronyd.pid
local daemon_args=
if yesno "$FAST_STARTUP"; then
ARGS="${ARGS} -n"
daemon_args="--background"
fi
ebegin "Starting chronyd"
start-stop-daemon --start --quiet \
start-stop-daemon $daemon_args --start --quiet \
--exec /usr/sbin/chronyd \
--pidfile "${PIDFILE}" \
-- -f "${CFGFILE}" ${ARGS}