2 # Author: Jan Vcelak <jvcelak@redhat.com>
4 . /usr/libexec/openldap/functions
6 if [ `id -u` -ne 0 ]; then
7 error "You have to be root to run this command."
14 for dbdir in `databases`; do
15 upgrade_log="$dbdir/db_upgrade.`date +%Y%m%d%H%M%S`.log"
16 bdb_files=`find "$dbdir" -maxdepth 1 -name "*.bdb" -printf '"%f" '`
18 # skip uninitialized database
19 [ -z "$bdb_files"] || continue
21 printf "Updating '%s', logging into '%s'\n" "$dbdir" "$upgrade_log"
25 "/usr/bin/db_recover -v -h \"$dbdir\"" \
26 "/usr/bin/db_upgrade -v -h \"$dbdir\" $bdb_files" \
27 "/usr/bin/db_checkpoint -v -h \"$dbdir\" -1" \
29 printf "Executing: %s\n" "$command" &>>$upgrade_log
30 run_as_ldap "$command" &>>$upgrade_log
32 printf "Exit code: %d\n" $result >>"$upgrade_log"
33 if [ $result -ne 0 ]; then
34 printf "Upgrade failed: %d\n" $result