This repository has been archived on 2025-04-28. You can view files and clone it, but cannot push or open issues or pull requests.
solr-shard-management/solr-ssh-copy.sh
2022-05-11 18:51:20 +00:00

32 lines
701 B
Bash
Executable File

#!/bin/bash
. ./setenv.sh
if [[ ! -z "$SOLR_LOCALPATH" ]]; then
SOLR_LOCALPATH=/tmp
fi
ARG_SSH_SOURCE=$1
ARG_SSH_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_SSH_SOURCE" ]]; then
echo "A source SSH host is required"
exit 1
fi
if [[ ! -z "$ARG_SSH_TARGET" ]]; then
echo "A target SSH host is required"
exit 1
fi
# copy from one node to the other
scp -r ${ARG_SSH_SOURCE}:${SOLR_LOCALPATH}/snapshot.${ARG_BACKUP_TIMESTAMP} /tmp
scp -r /tmp/snapshot.${ARG_BACKUP_TIMESTAMP} ${ARG_SSH_TARGET}:${SOLR_LOCALPATH}
rm -rf /tmp/snapshot.${ARG_BACKUP_TIMESTAMP}