SUNScholar/Export on the old server

Back to Export & Import

Create the folders
Become the root user by typing: sudo -i Make an exports folder as follows: mkdir /home/exports Make a scripts folder as follows: mkdir /root/scripts

Create export script
Make an export script file as follows: nano /root/scripts/collection-export Copy and paste the following to the file open with the editor. . config
 * 1) !/bin/bash
 * 2) Define the configs.

if [ ! -d $EXPORT ]; then echo "Please make an export folder available." exit 1 fi
 * 1) Create the folders

for i in `cat collections`; do    ECID=$i if [ ! -d $EXPORT/$ECID ]; then mkdir $EXPORT/$ECID echo "Exporting collection no: $ECID" >> $EXPORT/export.log $DSHOME/bin/dspace export -d $EXPORT/$ECID -t COLLECTION -n 100 -i $HANDLE/$ECID else echo "Collection:$ECID already exported." >> $EXPORT/export.log fi done
 * 1) Do the exports.

chmod -R 0777 $EXPORT chown -R root.root $EXPORT
 * 1) Give all permissions

'''Please note: The "-m" will export items without repository metadata, iow: a clean export. This is for migration not movement of assets. Only available from DSpace version 1.6.0. '''

Now make the file executeable as follows: chmod 0755 /root/scripts/collection-export

Create export config file
Make a config file as follows: nano /root/scripts/config Copy and paste the following into editor. DSHOME="$HOME" HANDLE="123456789" EXPORT="$HOME/exports" Modify the above to suit your site.

Create export collections file
Make collections file as follows: nano /root/scripts/collections Copy and paste the following into the editor. 12 34 23 56 21 Change the above to reflect the collection handle ID's you want to export.

Do the export
Run the script as follows: /root/scripts/collection-export

To watch the log file as the exports happen, type the following after opening another terminal: tail -f /home/exports/export.log

Create an exports tarball archive
After the exports are complete, make a tarball backup as follows: cd /home

tar -czvf exports.tgz exports/ Now copy the tarball (exports.tgz) to a portable disk or remote backup device.