diff --git a/src/gcube-start-container.sh b/src/gcube-start-container.sh index ca53178..53e09f1 100644 --- a/src/gcube-start-container.sh +++ b/src/gcube-start-container.sh @@ -8,11 +8,15 @@ if [ -n "$EXIST_HOME" ]; then echo "eXist data should be already in place on NFS" elif [ -d "$EXIST_HOME/webapp/WEB-INF/data" ] ; then echo "First run: set up our directory structure on the NFS mountpoint" - mkdir -p /gcube-data/{db,backup} - mv $EXIST_HOME/webapp/WEB-INF/{data,logs,attachments} /gcube-data/db - for dir in {data,logs,attachments}; do - ln -s /gcube-data/db/${dir} $EXIST_HOME/webapp/WEB-INF/${dir} - done + mkdir -p /gcube-data/{db,backup} && mv $EXIST_HOME/webapp/WEB-INF/{data,logs,attachments} /gcube-data/db + if [ $? -eq 0 ]; then + for dir in {data,logs,attachments}; do + ln -s /gcube-data/db/${dir} $EXIST_HOME/webapp/WEB-INF/${dir} + done + elif + echo "Move failed: data already exists on NFS" + exit 1 + fi else echo "Not a link, not a directory: a pony :-)?" fi