SUNScholar/Export on the old server
Contents
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.
#!/bin/bash
# Define the configs.
. config
# Create the folders
if [ ! -d $EXPORT ]; then
echo "Please make an export folder available."
exit 1
fi
# Do the exports.
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 -m -d $EXPORT/$ECID -t COLLECTION -n 100 -i $HANDLE/$ECID
else
echo "Collection:$ECID already exported." >> $EXPORT/export.log
fi
done
# Give all permissions
chmod -R 0777 $EXPORT
chown -R root.root $EXPORT
Please note: The -m means export without metadata. This is for migration not movement of assets. Only available from DSpace version 1.6.0.
Save the file and exit the editor.
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.
HANDLE="123456789" EXPORT="/home/exports" DSHOME="/home/dspace" PERSON="admin@myrepo.ac.za"
Modify the above to suit your site and then save and exit the file.
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. See the procedure outlined at the top of this page to determine the collection ID's.
Save the file and exit.
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.