/usr/sbin/db2index is in 389-ds-base 1.3.7.10-1ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | #!/bin/bash
. /usr/share/dirsrv/data/DSSharedLib
libpath_add "/usr/lib/x86_64-linux-gnu/dirsrv/"
libpath_add ""
libpath_add "/usr/lib/x86_64-linux-gnu"
libpath_add "/usr/lib/x86_64-linux-gnu"
export LD_LIBRARY_PATH
SHLIB_PATH=$LD_LIBRARY_PATH
export SHLIB_PATH
usage ()
{
echo "Usage: db2index [-Z serverID] [-n backend | {-s includesuffix}* -t attribute[:indextypes[:matchingrules]]"
echo " -T vlvTag] [-v] [-h]"
echo "Options:"
echo " -Z serverID - Server instance identifier"
echo " -n backend - Backend database name. Example: userRoot"
echo " -s includeSuffix - The suffix to index"
echo " -t attribute[:indextypes[:matchingrules]]"
echo " - attributeName: name of the attribute to be indexed";
echo " If omitted, all the indexes defined for that instance are generated."
echo " - indextypes: comma separated index types"
echo " - matchingrules: comma separated matrules"
echo " Example: -t foo:eq,pres"
echo " -T vlvTag - VLV index name"
echo " -v - Display version"
echo " -h - Display usage"
}
while getopts "hZ:n:s:t:T:vd:a:SD:x:" flag
do
case $flag in
h) usage
exit 0;;
Z) servid=$OPTARG;;
n) args=$args" -n \"$OPTARG\""
benameopt="set";;
s) args=$args" -s \"$OPTARG\""
includeSuffix="set";;
t) args=$args" -t "\"$OPTARG\";;
T) args=$args" -T "\"$OPTARG\";;
d) args=$args" -d \"$OPTARG\"";;
a) args=$args" -a \"$OPTARG\"";;
x) args=$args" -x \"$OPTARG\"";;
v) args=$args" -v";;
S) args=$args" -S";;
D) args=$args" -D $OPTARG";;
?) usage
exit 1;;
esac
done
argnum=$#
shift $(($OPTIND - 1))
if [ $1 ]
then
echo "ERROR - Unknown option: $1"
usage
exit 1
fi
initfile=$(get_init_file "/etc/default" $servid)
if [ $? -eq 1 ]
then
usage
echo "You must supply a valid server instance identifier. Use -Z to specify instance name"
echo "Available instances: $initfile"
exit 1
fi
idxall=0
print_usage=0
if [ -z $servid ] && [ $argnum -eq 0 ]; then
idxall=1
elif [ "$servid" ] && [ $argnum -eq 2 ]; then
idxall=1
elif [ -z $benameopt ] && [ -z $includeSuffix ]; then
print_usage=1
fi
if [ -z $servid ] && [ $argnum -lt 2 ]; then
print_usage=1
elif [ -n "$servid" ] && [ $argnum -lt 4 ]; then
print_usage=1
elif [ -n "$servid" ] && [ $argnum -eq 4 ]; then
idxall=1
fi
servid=`normalize_server_id $initfile`
. $initfile
if [ $idxall -eq 1 ]
then
bak_dir=/var/lib/dirsrv/slapd-$servid/bak/reindex_`date +%Y_%m_%d_%H_%M_%S`
/usr/sbin/ns-slapd upgradedb -D $CONFIG_DIR -a "$bak_dir" -f |& egrep -v "util_info_sys_page|check_and_set_import_cache|WARNING|Backing up" | sed -e "s/upgrade DB/Reindex/" | sed -e "s/upgradedb/reindexing/"
elif [ $print_usage -eq 1 ]
then
usage
exit 1
else
eval /usr/sbin/ns-slapd db2index -D $CONFIG_DIR $args |& egrep -v "util_info_sys_page|check_and_set_import_cache|WARNING|Backing up" | sed -e "s/upgrade DB/Reindex/" | sed -e "s/upgradedb/reindexing/"
fi
|