Last active
February 14, 2024 16:25
-
-
Save jwestgard/ecac78a3c47b2cc98156982f5730a0ef to your computer and use it in GitHub Desktop.
Export and download objects from Dspace running in k8s
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/zsh | |
| DIR='output' | |
| for HANDLE in $@; do | |
| ID=${HANDLE#http://hdl.handle.net/1903/*} | |
| DEST="$DIR/$ID" | |
| EXPORT_CMD="/dspace/bin/dspace export -t ITEM -i 1903/$ID -d /dspace/upload -n $ID" | |
| DELETE_CMD="rm -rf /dspace/upload/$ID" | |
| if [ -d $DEST ]; then | |
| echo "$DEST exists; skipping..." | |
| else | |
| kubectl exec -it drum-0 -- /bin/bash -c "$EXPORT_CMD" && \ | |
| sleep 3 && \ | |
| kubectl cp --retries 10 drum-0:/dspace/upload/$ID $DEST && \ | |
| kubectl exec -it drum-0 -- /bin/bash -c "$DELETE_CMD" | |
| fi | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment