Difference between revisions of "SUNScholar/Export on the old server"
| (22 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
| + | <center> | ||
| + | '''[[SUNScholar/Export and Import Artifacts/Via Simple Archive Format|Back to Export & Import]]''' | ||
| + | </center> | ||
| + | |||
===Create the folders=== | ===Create the folders=== | ||
Become the root user by typing: | Become the root user by typing: | ||
| Line 27: | Line 31: | ||
mkdir $EXPORT/$ECID | mkdir $EXPORT/$ECID | ||
echo "Exporting collection no: $ECID" >> $EXPORT/export.log | echo "Exporting collection no: $ECID" >> $EXPORT/export.log | ||
| − | $DSHOME/bin/dspace export | + | $DSHOME/bin/dspace export -d $EXPORT/$ECID -t COLLECTION -n 100 -i $HANDLE/$ECID |
else | else | ||
echo "Collection:$ECID already exported." >> $EXPORT/export.log | echo "Collection:$ECID already exported." >> $EXPORT/export.log | ||
| Line 37: | Line 41: | ||
chown -R root.root $EXPORT | chown -R root.root $EXPORT | ||
</pre> | </pre> | ||
| + | |||
| + | ---- | ||
| + | |||
| + | '''Please note: <font color="red">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.</font>''' | ||
{{NANO}} | {{NANO}} | ||
| − | |||
| − | |||
Now make the file executeable as follows: | Now make the file executeable as follows: | ||
| Line 50: | Line 56: | ||
Copy and paste the following into editor. | Copy and paste the following into editor. | ||
<pre> | <pre> | ||
| + | DSHOME="$HOME" | ||
HANDLE="123456789" | HANDLE="123456789" | ||
| − | EXPORT=" | + | EXPORT="$HOME/exports" |
| − | |||
| − | |||
</pre> | </pre> | ||
| − | Modify the above to suit your site | + | Modify the above to suit your site. |
| + | |||
| + | {{NANO}} | ||
===Create export collections file=== | ===Create export collections file=== | ||
| Line 68: | Line 75: | ||
21 | 21 | ||
</pre> | </pre> | ||
| − | '''Change the above to reflect the collection handle ID's you want to export | + | '''Change the above to reflect the collection handle ID's you want to export.''' |
| − | + | {{NANO}} | |
===Do the export=== | ===Do the export=== | ||
| Line 85: | Line 92: | ||
tar -czvf exports.tgz exports/ | tar -czvf exports.tgz exports/ | ||
Now copy the tarball (exports.tgz) to a portable disk or remote backup device. | Now copy the tarball (exports.tgz) to a portable disk or remote backup device. | ||
| + | [[Category:Customisation]] | ||
Latest revision as of 15:59, 29 May 2016
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.