Update start-container script to check if data are already on NFS

This commit is contained in:
Antonio Calanducci 2023-11-06 16:16:58 +01:00
parent bcf02f938d
commit 28dcff38ea
1 changed files with 9 additions and 5 deletions

View File

@ -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