Add updatedb-mirrors script.
This commit is contained in:
parent
d0958ecc33
commit
2930ee0a45
1 changed files with 26 additions and 0 deletions
26
updatedb-mirrors
Executable file
26
updatedb-mirrors
Executable file
|
|
@ -0,0 +1,26 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Version: 0.1.0
|
||||||
|
# Copyright (c) 2023:
|
||||||
|
# Darren 'Tadgy' Austin <darren (at) afterdark.org.uk>
|
||||||
|
# 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
|
||||||
Loading…
Add table
Add a link
Reference in a new issue