Commit 4109adf0d9d022c0ac9a6dd06953ac2cbab71605

Authored by Fernando Ribeiro

Merge branch 'DSpace52++' of gitlab.fccn.pt:dev-rcaap/dspace into DSpace52++

dspace/bin/RCAAP-packager-export_verify-items.sh
... ... @@ -6,6 +6,11 @@
6 6 RESULT_FILE_NAME="/var/tmp/dspace/dspace_aip_dump_status"
7 7 LOG_FILE="/var/log/dspace/export_aip.log"
8 8  
  9 +
  10 +# JAVA memory allocation
  11 +export JAVA_OPTS="-Xmx1024M -Xms512M -Dfile.encoding=UTF-8"
  12 +
  13 +
9 14 # Current script dir
10 15 pushd `dirname $0` > /dev/null
11 16 SCRIPTPATH=`pwd`
... ... @@ -75,11 +80,11 @@ if [ -z "$BACKUP_DIR" ]; then
75 80 BACKUP_DIR="${SCRIPTPATH}/../exports"
76 81 fi
77 82  
78   -#first, retrive the number of archived items in database
79   -NUMBER_ITEMS=(`echo "SELECT count(*) FROM item WHERE in_archive=TRUE AND discoverable=TRUE;" | psql -tU postgres dspace|sed 's| ||g'`)
  83 +#first, retrive the number of archived items in database associated with a prefix
  84 +NUMBER_ITEMS=(`echo "SELECT count(*) FROM item LEFT JOIN handle ON item.item_id = handle.resource_id AND handle.resource_type_id = 2 AND handle.handle LIKE '${HANDLE_PREFIX}/%' WHERE in_archive=TRUE AND handle.handle IS NOT NULL;" | psql -tU postgres dspace|sed 's| ||g'`)
80 85  
81 86 #export AIP packages
82   -${SCRIPTPATH}/dspace packager -d -a -u -t AIP -e ${EMAIL} -i ${HANDLE_PREFIX}/0 ${BACKUP_DIR}/sitewide-aip.zip>${LOG_FILE}
  87 +${SCRIPTPATH}/dspace packager -d -a -u -t AIP -e ${EMAIL} -i ${HANDLE_PREFIX}/0 ${BACKUP_DIR}/${HANDLE_PREFIX}-aip.zip &> ${LOG_FILE}
83 88  
84 89 #find on the backup directory and count the number of just created files
85 90 NUMBER_BACKUPS=(`find $BACKUP_DIR -mtime 0 ! -size 0 -type f -name "ITEM*.zip" | wc -l`)
... ... @@ -88,4 +93,4 @@ if [ "$NUMBER_BACKUPS" = "$NUMBER_ITEMS" ]; then
88 93 echo "1" > ${RESULT_FILE_NAME}
89 94 else
90 95 echo "0" > ${RESULT_FILE_NAME}
91 96 -fi
  97 +fi
92 98 \ No newline at end of file
... ...