diff --git a/updatedb-mirrors b/updatedb-mirrors new file mode 100755 index 0000000..f4ea9a3 --- /dev/null +++ b/updatedb-mirrors @@ -0,0 +1,26 @@ +#!/bin/bash +# Version: 0.1.0 +# Copyright (c) 2023: +# Darren 'Tadgy' Austin +# Licensed under the terms of the GNU General Public License version 3. +# +# Update the locate database used specifically for the search interface on slackware.uk. + +# Configuration. +DBFILE="/run/mirrors.db" +FILETREE="/storage/md0" +COMMAND="/usr/bin/updatedb" + +# Sanity check. +[[ ! -x "$COMMAND" ]] && { + printf "%s: '%s' %s\\n" "${0##*/}" "$COMMAND" "is not executable" >&2 + exit 1 +} + +# Update the database. +nice -n 19 ionice -c3 "$COMMAND" -l 0 -o "$DBFILE" -U "$FILETREE" || { + printf "%s: %s\\n" "${0##*/}" "failed to update locate database" >&2 + exit 1 +} + +exit 0