Skip to content

Instantly share code, notes, and snippets.

@RaimondKempees
Created December 10, 2015 15:20
Show Gist options
  • Save RaimondKempees/4b54b90e81d5fd1d0a90 to your computer and use it in GitHub Desktop.
Save RaimondKempees/4b54b90e81d5fd1d0a90 to your computer and use it in GitHub Desktop.
#!/bin/sh
##
# Syncs index and business configuration. Run this script from the Fredhopper root!
#
# Command Line parameters:
# SOURCE_LOCATION: the hostname of the source index
# DESTINATION_LOCATION: the hostname of the target index
# SOURCE_INDEX_NAME: the name of the source index
# DESTINATION_INDEX_NAME: the name of the target index
# CAPTURE_FILE_NAME: the file name of the capture file
# FREDHOPPER_BASE_DIR: the base directory of the Fredhopper installation you are on
#
# example:
#
# ./sync.sh index-server-1.domain.net index-server-2.domain.net index-1 index-2 /tmp/captures/20151210-1100-capture.zip /usr/share/fredhopper
SOURCE_LOCATION=$1
DESTINATION_LOCATION=$2
SOURCE_INDEX_NAME=$3
DESTINATION_INDEX_NAME=$4
CAPTURE_FILE_NAME=$5
FREDHOPPER_BASE_DIR=$6
echo "Start exporting"
$FREDHOPPER_BASE_DIR/bin/deployment-agent-client --location http://$SOURCE_LOCATION:8177/ -O $CAPTURE_FILE_NAME export-capture -c -i -x $SOURCE_INDEX_NAME
echo "Finished exporting"
echo "Stopping index: $DESTINATION_INDEX_NAME"
$FREDHOPPER_BASE_DIR/bin/instance $DESTINATION_INDEX_NAME stop
echo "Start importing"
$FREDHOPPER_BASE_DIR/bin/deployment-agent-client --location http://$DESTINATION_LOCATION:8177/ import-capture $DESTINATION_INDEX_NAME $CAPTURE_FILE_NAME
echo "Finished importing"
echo "Starting stuff"
$FREDHOPPER_BASE_DIR/bin/instance $DESTINATION_INDEX_NAME start
echo "Finished starting stuff. If required, perform a fresh-index-to-live to get the new data to the query servers"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment