#!/bin/sh source @datadir@/@package_name@/data/DSSharedLib libpath_add "@libdir@/@package_name@/" libpath_add "@nss_libdir@" libpath_add "@libdir@" libpath_add "@pcre_libdir@" 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] [-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 " -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 if [ -z $benameopt ] && [ -z $includeSuffix ] then usage exit 1; fi initfile=$(get_init_file "@initconfigdir@" $servid) if [ $? == 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 servid=`normalize_server_id $initfile` . $initfile if [ $# -eq 0 ] then bak_dir=@localstatedir@/lib/@PACKAGE_NAME@/slapd-$servid/bak/reindex_`date +%Y_%m_%d_%H_%M_%S` @sbindir@/ns-slapd upgradedb -D $CONFIG_DIR -a "$bak_dir" elif [ $# -lt 2 ] then usage exit 1 else @sbindir@/ns-slapd db2index -D $CONFIG_DIR $args fi