SHA256
1
0
forked from pool/man
man/cron.daily.do_mandb

72 lines
1.7 KiB
Bash

#!/bin/bash
#
#
# do_mandb. This script was split off cron.daily.
# Please add your local changes to cron.daily.local
# since this file will be overwritten, when updating your system.
#
# Copyright (c) 1996-2002 SuSE GmbH Nuernberg, Germany.
# Copyright (c) 2008 SuSE LINUX Products GmbH Nuernberg, Germany.
#
# please send bugfixes or comments to feedback@suse.de.
#
# Author: Werner Fink <feedback@suse.de>, 2008, 2019
# Burchard Steinbild <feedback@suse.de>, 1996
# Florian La Roche <feedback@suse.de>, 1996
#
#
# paranoia settings
#
umask 022
PATH=/sbin:/bin:/usr/sbin:/usr/bin
export PATH
#
# get information from /etc/sysconfig/cron
#
if test -f /etc/sysconfig/cron ; then
. /etc/sysconfig/cron
fi
#
# now we do the man page stuff
#
if test "$REINIT_MANDB" = yes ; then
if type -p mandb > /dev/null 2>&1 ; then
typeset -r manpaths=$(manpath -g)
typeset -i errors=0
renice +5 -p $$ > /dev/null || true
ionice -c 3 -p $$ > /dev/null || true
unset MANPATH
IFS=:
for mp in $manpaths; do
test -d "${mp}" || continue
cp=$(MANPATH=$mp manpath -qc)
test -n "${cp}" || continue
test -d "${cp}" || continue
db=${cp}/index.db
if test -e ${db} ; then
path="$(find $mp -follow -newer $db 2>/dev/null)"
test -n "$path" || continue
fi
nice -n 5 ionice -c 3 mandb -qs ${mp} > /dev/null 2>&1 || let errors++
done
if test $errors -ne 0 ; then
echo There seem to be trouble with mandb.
echo
echo please run mandb and check the output...
fi
fi
#
# some applications need whatis database. If makewhatis exists, call it
#
if type -p makewhatis > /dev/null 2>&1 ; then
makewhatis
fi
fi
exit 0