Skip to content

Commit

Permalink
Added script to copy solr
Browse files Browse the repository at this point in the history
  • Loading branch information
sgeulette committed Feb 22, 2022
1 parent a2b90ca commit 8a4c0a8
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ buildout: ## Runs setup and buildout
copy: ## Runs `copy-data.sh`
@# copy-data is generated by puppet when data_source is found
if [ $(copydata) = 1 ] && [ -f copy-data.sh ]; then ./copy-data.sh; fi
# if [ $(copydata) = 1 ] && [ -f bin/solr-start ]; then ./copy-solr.sh; fi
@$ echo "copy-data finished for instance $(plone), check http://$(hostname):$(instance1_port)/manage_main" | mail -s "copy-data finished" [email protected]

.PHONY: upgrade
Expand Down
34 changes: 34 additions & 0 deletions copy-solr.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bash

#set -ex

SOURCE_HOST="$(grep SOURCE_HOST= copy-data.sh|cut -d '=' -f 2 | tr -d '"')"
SOURCE_PATH="$(grep SOURCE_PATH= copy-data.sh|cut -d '=' -f 2 | tr -d '"')"
LOG="copy-solr.log"

if [ "$(whoami)" != "zope" ]; then
echo "This script must be run as zope"
exit -1
fi

if [ -f ${LOG} ]; then
echo "It looks like this script has already been run."
echo "If you want to run it again, please delete the '${LOG}' file."
exit -1
fi

if [ ! -f bin/solr-start ]; then
echo "It looks like bin/solr-start is not present in this directory."
exit -1
fi

exec > >(tee -i ${LOG})
exec 2>&1

echo `date`
echo
echo "Copying solr files from ${SOURCE_HOST}:${SOURCE_PATH}/var/solr to var/ :"
rsync -e "ssh -o StrictHostKeyChecking=no" -avhP "${SOURCE_HOST}:${SOURCE_PATH}/var/solr" var/ --delete

echo
echo `date`

0 comments on commit 8a4c0a8

Please sign in to comment.