add chrony-wait service

This commit is contained in:
Miroslav Lichvar 2011-06-24 16:26:26 +02:00
parent 259c5c431c
commit 38c78973b4
2 changed files with 23 additions and 3 deletions

16
chrony-wait.service Normal file
View File

@ -0,0 +1,16 @@
[Unit]
Description=Wait for chrony to synchronize system clock
After=chronyd.service
Requires=chronyd.service
Before=time-sync.target
Wants=time-sync.target
[Service]
Type=oneshot
# Wait up to ~10 minutes for chronyd to synchronize and the remaining
# clock correction to be less than 0.1 seconds
ExecStart=/usr/bin/chronyc waitsync 60 0.1
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target

View File

@ -17,6 +17,7 @@ Source5: chrony.logrotate
Source6: timepps.h Source6: timepps.h
Source7: chrony.nm-dispatcher Source7: chrony.nm-dispatcher
Source8: chrony.dhclient Source8: chrony.dhclient
Source9: chrony-wait.service
%{?gitpatch:Patch0: chrony-%{version}-%{gitpatch}.patch.gz} %{?gitpatch:Patch0: chrony-%{version}-%{gitpatch}.patch.gz}
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -81,6 +82,8 @@ install -m 755 -p %{SOURCE7} \
$RPM_BUILD_ROOT%{_sysconfdir}/NetworkManager/dispatcher.d/20-chrony $RPM_BUILD_ROOT%{_sysconfdir}/NetworkManager/dispatcher.d/20-chrony
install -m 755 -p %{SOURCE8} \ install -m 755 -p %{SOURCE8} \
$RPM_BUILD_ROOT%{_sysconfdir}/dhcp/dhclient.d/chrony.sh $RPM_BUILD_ROOT%{_sysconfdir}/dhcp/dhclient.d/chrony.sh
install -m 644 -p %{SOURCE9} \
$RPM_BUILD_ROOT/lib/systemd/system/chrony-wait.service
touch $RPM_BUILD_ROOT%{_localstatedir}/lib/chrony/{drift,rtc} touch $RPM_BUILD_ROOT%{_localstatedir}/lib/chrony/{drift,rtc}
@ -106,8 +109,9 @@ fi
%preun %preun
if [ "$1" -eq 0 ]; then if [ "$1" -eq 0 ]; then
/bin/systemctl --no-reload disable chronyd.service &> /dev/null /bin/systemctl --no-reload disable \
/bin/systemctl stop chronyd.service &> /dev/null chrony-wait.service chronyd.service &> /dev/null
/bin/systemctl stop chrony-wait.service chronyd.service &> /dev/null
/sbin/install-info --delete %{_infodir}/chrony.info.gz \ /sbin/install-info --delete %{_infodir}/chrony.info.gz \
%{_infodir}/dir &> /dev/null %{_infodir}/dir &> /dev/null
fi fi
@ -132,7 +136,7 @@ fi
%{_sbindir}/chronyd %{_sbindir}/chronyd
%{_libexecdir}/chrony-helper %{_libexecdir}/chrony-helper
%{_infodir}/chrony.info* %{_infodir}/chrony.info*
/lib/systemd/system/chronyd.service /lib/systemd/system/chrony*.service
%{_mandir}/man[158]/%{name}*.[158]* %{_mandir}/man[158]/%{name}*.[158]*
%dir %attr(-,chrony,chrony) %{_localstatedir}/lib/chrony %dir %attr(-,chrony,chrony) %{_localstatedir}/lib/chrony
%ghost %attr(-,chrony,chrony) %{_localstatedir}/lib/chrony/drift %ghost %attr(-,chrony,chrony) %{_localstatedir}/lib/chrony/drift