SUNScholar/Export on the old server
Back to Export & Import
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 -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" 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.
- NANO Editor Help
CTL+O | = Save the file and then press Enter |
CTL+X | = Exit "nano" |
CTL+K | = Delete line |
CTL+U | = Undelete line |
CTL+W | = Search for %%string%% |
CTL+\ | = Search for %%string%% and replace with $$string$$ |
CTL+C | = Show line numbers |
More info = http://en.wikipedia.org/wiki/Nano_(text_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.
DSHOME="$HOME" HANDLE="123456789" EXPORT="$HOME/exports"
Modify the above to suit your site.
- NANO Editor Help
CTL+O | = Save the file and then press Enter |
CTL+X | = Exit "nano" |
CTL+K | = Delete line |
CTL+U | = Undelete line |
CTL+W | = Search for %%string%% |
CTL+\ | = Search for %%string%% and replace with $$string$$ |
CTL+C | = Show line numbers |
More info = http://en.wikipedia.org/wiki/Nano_(text_editor)
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.
- NANO Editor Help
CTL+O | = Save the file and then press Enter |
CTL+X | = Exit "nano" |
CTL+K | = Delete line |
CTL+U | = Undelete line |
CTL+W | = Search for %%string%% |
CTL+\ | = Search for %%string%% and replace with $$string$$ |
CTL+C | = Show line numbers |
More info = http://en.wikipedia.org/wiki/Nano_(text_editor)
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.