switching back to crontabs

- resolves: #1177993
- resolves: #1171450
This commit is contained in:
Jan Chaloupka 2015-01-02 10:24:39 +01:00
parent ed33a7aff7
commit 2eef02f327
5 changed files with 53 additions and 36 deletions

27
man-db.crondaily Normal file
View File

@ -0,0 +1,27 @@
#!/bin/bash
if [ -e /etc/sysconfig/man-db ]; then
. /etc/sysconfig/man-db
fi
if [ "$CRON" = "no" ]; then
exit 0
fi
renice +19 -p $$ >/dev/null 2>&1
ionice -c3 -p $$ >/dev/null 2>&1
LOCKFILE=/var/lock/man-db.lock
# the lockfile is not meant to be perfect, it's just in case the
# two man-db cron scripts get run close to each other to keep
# them from stepping on each other's toes. The worst that will
# happen is that they will temporarily corrupt the database
[[ -f $LOCKFILE ]] && exit 0
trap "{ rm -f $LOCKFILE ; exit 0; }" EXIT
touch $LOCKFILE
# create/update the mandb database
mandb $OPTS
exit 0

View File

@ -1,10 +0,0 @@
[Unit]
Description=Update man-db cache
RequiresMountsFor=/var/cache/man
[Service]
Type=oneshot
ExecStart=/usr/bin/mandb --quiet
Nice=19
IOSchedulingClass=best-effort
IOSchedulingPriority=7

View File

@ -4,7 +4,7 @@
Summary: Tools for searching and reading man pages
Name: man-db
Version: 2.7.1
Release: 2%{?dist}
Release: 3%{?dist}
# GPLv2+ .. man-db
# GPLv3+ .. gnulib
License: GPLv2+ and GPLv3+
@ -12,8 +12,8 @@ Group: System Environment/Base
URL: http://www.nongnu.org/man-db/
Source0: http://download.savannah.gnu.org/releases/%{name}/%{name}-%{version}.tar.xz
Source1: man-db.service
Source2: man-db.timer
Source1: man-db.crondaily
Source2: man-db.sysconfig
Patch0: 1151558-switch-man-and-root-in-init-systemd-man-db.conf.patch
Patch1: 1161747-src-man.c-do_extern-Pass-the-l-option-through.patch
@ -23,9 +23,9 @@ Provides: man-pages-reader = %{version}
# FPC exception for gnulib - copylib - https://fedorahosted.org/fpc/ticket/174
Provides: bundled(gnulib) = %{gnulib_ver}
Requires: coreutils, grep, groff-base, gzip, less, systemd
Requires: coreutils, grep, groff-base, gzip, less, crontabs
BuildRequires: gdbm-devel, gettext, groff, less, libpipeline-devel, zlib-devel
BuildRequires: po4a, systemd
BuildRequires: po4a
%description
The man-db package includes five tools for browsing man-pages:
@ -63,10 +63,11 @@ rm $RPM_BUILD_ROOT%{_libdir}/man-db/*.la
# install cache directory
install -d -m 0755 $RPM_BUILD_ROOT%{cache}
# install systemd service and timer files for man-db creation/update
mkdir -p %{buildroot}%{_unitdir}
install -D -p -m 0644 %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}/%{name}.service
install -D -p -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_unitdir}/%{name}.timer
# install cron script for man-db creation/update
install -D -p -m 0755 %{SOURCE1} $RPM_BUILD_ROOT/etc/cron.daily/man-db.cron
# config for cron script
install -D -p -m 0644 %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/man-db
# config for tmpfiles.d
install -D -p -m 0644 init/systemd/man-db.conf $RPM_BUILD_ROOT/usr/lib/tmpfiles.d/.
@ -77,13 +78,11 @@ install -D -p -m 0644 init/systemd/man-db.conf $RPM_BUILD_ROOT/usr/lib/tmpfiles.
# clear the old cache
%post
%{__rm} -rf %{cache}/*
# enable and start timer
systemctl -q enable man-db.timer
systemctl start man-db.timer
%preun
# stop and disable timer
if [ "$1" -eq 0 ]; then
# stop and disable timer from previous builds
rpm -q systemd > /dev/null
if [ "$?" -eq 0 ]; then
systemctl stop man-db.timer
systemctl -q disable man-db.timer
fi
@ -93,8 +92,8 @@ fi
%license docs/COPYING
%doc README man-db-manual.txt man-db-manual.ps ChangeLog NEWS
%config(noreplace) %{_sysconfdir}/man_db.conf
%{_unitdir}/man-db.service
%{_unitdir}/man-db.timer
%config(noreplace) %{_sysconfdir}/sysconfig/man-db
%config(noreplace) %{_sysconfdir}/cron.daily/man-db.cron
%config(noreplace) /usr/lib/tmpfiles.d/man-db.conf
%{_sbindir}/accessdb
%{_bindir}/man
@ -135,6 +134,11 @@ fi
%lang(zh_CN) %{_datadir}/man/zh_CN/man*/*
%changelog
* Fri Jan 02 2015 jchaloup <jchaloup@redhat.com> - 2.7.1-3
- switching back to crontabs
resolves: #1177993
resolves: #1171450
* Thu Nov 13 2014 jchaloup <jchaloup@redhat.com> - 2.7.1-2
- src/man.c (do_extern): Pass the -l option through
resolves: #1161747

6
man-db.sysconfig Normal file
View File

@ -0,0 +1,6 @@
# Set to no to disable daily man-db update by /etc/cron.daily/man-db.cron
CRON="yes"
# Options used by mandb in /etc/cron.daily/man-db.cron,
# we use -q as default, too much noise without.
OPTS="-q"

View File

@ -1,10 +0,0 @@
[Unit]
Description=Daily man-db cache update
[Timer]
OnCalendar=daily
AccuracySec=12h
Persistent=true
[Install]
WantedBy=multi-user.target