summaryrefslogtreecommitdiff
path: root/system/man-db/man-db.cron
blob: 93c3a00ff2c64f6651b48b5b9cc2c5e0ae4c28f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh

# man-db daily cronjob, part of the slackbuilds.org man-db package.
# Author: B. Watson.
# Adapted from Debian's man-db package, so I guess the license is GPL.

set -e

if ! [ -d /var/cache/man ]; then
  # Recover from deletion, per FHS.
  mkdir -p /var/cache/man
  chown root:root /var/cache/man || true
  chmod 2755 /var/cache/man
fi

# expunge old catman pages which have not been read in a week
# commented out, as we've got cat pages disabled in this build. Left
# here for reference in case someone really wants to enable cat pages
# some day.
#find /var/cache/man -type f -name '*.gz' -atime +6 -print0 | xargs -r0 rm -f &> /dev/null

# regenerate man database. /opt/man-db/bin probably isn't in cron's $PATH,
# so check for it specially, otherwise use $PATH.
if [ -x /opt/man-db/bin/mandb ]; then
  MANDB=/opt/man-db/bin/mandb
else
  MANDB=mandb
fi

$MANDB --no-purge --quiet