diff --git a/localdump.sh b/localdump.sh index 12d41f4fae32ce1048fc50752ac6564949cc2c41..39d42968ae8f5c5a567fbc5972b3f290d61358da 100755 --- a/localdump.sh +++ b/localdump.sh @@ -191,17 +191,20 @@ } # ------------------------------------------------------------ - # restore: show databases that can be restored - # param string file filter optional; + # restore: show databases or dumps of a given database that can be restored + # param string optional: DB-Name for file filter to select from existing dumps; function listBackupedDBs(){ if [ -d "${BACKUP_TARGETDIR}" ]; then - cd "${BACKUP_TARGETDIR}" + if [ -z $1 ]; then - find -type f | sed "s#__[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]-[0-9][0-9].*##g" | grep -v "\.meta" | sort -ud| sed "s#^\./##g" + find "${BACKUP_TARGETDIR}" -mindepth 1 -maxdepth 1 -type f -exec basename {} \; \ + | sed "s#__[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]-[0-9][0-9].*##g" \ + | grep -v "\.meta" | sort -ud| sed "s#^\./##g" else - ls -ltr "$*__"* | sed "s#^\./##g" | grep -v "\.meta" + find "${BACKUP_TARGETDIR}" -mindepth 1 -maxdepth 1 -type f -name "${1}*" -exec basename {} \; \ + | sed "s#^\./##g" | grep -v "\.meta" fi - cd - >/dev/null + else color.echo error "ERROR: ${BACKUP_TARGETDIR} does not exist - here are no backups to restore." echo @@ -210,7 +213,7 @@ echo " $(dirname $0)/restore.sh $BACKUP_BASEDIR" echo "2) Copy restored dumps into $BACKUP_TARGETDIR" echo "3) Start database restore again" - echo " $(dirname $0)/localdump.sh restore [service]" + echo " $(dirname $0)/localdump.sh restore [profile]" echo exit 1 @@ -515,6 +518,7 @@ test -d "${ARCHIVE_BASEDIR}/${parService}" && BACKUP_BASEDIR="${ARCHIVE_BASEDIR}" fi + # ----- check if target dir with profile exists if [ ! -d "${BACKUP_BASEDIR}/${parService}" ]; then color.echo error "ERROR: Directory does not exist '${BACKUP_BASEDIR}/${parService}'." exit 1 @@ -570,7 +574,6 @@ BACKUP_PARAMS=$( dbdetect.getParams ) eval $( dbdetect.setenv ) - h2 $BACKUP_SCRIPT $mode "${sDumpfile}" "${sTargetDb}" . $BACKUP_SCRIPT $mode "${sDumpfile}" "${sTargetDb}" if [ $? -ne 0 -o $rc -ne 0 ]; then