#!/bin/bash . ./setenv.sh if [[ ! -z "$SOLR_LOCALPATH" ]]; then SOLR_LOCALPATH=/tmp fi ARG_DOCKER_SOURCE=$1 ARG_DOCKER_TARGET=$2 ARG_BACKUP_TIMESTAMP=$3 if [[ ! -z "$ARG_BACKUP_TIMESTAMP" ]]; then echo "A timestamp of the backup to copy is required" exit 1; fi if [[ ! -z "$ARG_DOCKER_SOURCE" ]]; then echo "A source Docker container name or ID is required" exit 1 fi if [[ ! -z "$ARG_DOCKER_TARGET" ]]; then echo "A target Docker container name or ID is required" exit 1 fi # copy from one node to the other docker container cp ${ARG_DOCKER_SOURCE}:${SOLR_LOCALPATH}/snapshot.${ARG_BACKUP_TIMESTAMP} /tmp docker container cp /tmp/snapshot.${ARG_BACKUP_TIMESTAMP} ${ARG_DOCKER_TARGET}:${SOLR_LOCALPATH} docker container exec --privileged -u root ${ARG_DOCKER_TARGET} chmod -R go+r ${SOLR_LOCALPATH}/snapshot.${ARG_BACKUP_TIMESTAMP} rm -rf /tmp/snapshot.${ARG_BACKUP_TIMESTAMP}