#!/bin/sh
# ers_setvars

REPLIC_JAVA=java
REPLIC_HOME=@prefix@
POSTGRES_HOME=@PGINC@

# start threads - if this flag is not 1 then replic/cleanup will run only once
REPLIC_THREADS=1

# start with recovery option - if connection to db goes down - it will try to recover
REPLIC_RECOVER=1

# start replication thread only
REPLIC_REPLIC=1

# start cleanup thread only
REPLIC_CLEAN=1

# set CLASSPATH
CLASSPATH=$REPLIC_HOME/lib/erserver.jar:$REPLIC_HOME/lib/jdbc7.0-1.2.jar:$REPLIC_HOME/lib/log4j.jar:$REPLIC_HOME/etc:$CLASSPATH

SU=_master_user_

SQL_DIR=../sql
SQL_TMP_DIR=$SQL_DIR/sql_tmp

MASTER_HOST=_master_server_
MASTER_PORT=_master_port_
MASTER_USER=_master_user_
MASTER_PASS=_master_pass_
MASTER_DB=_master_database_

SLAVE_HOST=_slave_server_
SLAVE_PORT=_slave_port_
SLAVE_USER=_slave_user_
SLAVE_PASS=_slave_pass_
SLAVE_DB=_slave_database_

SQL_GEN_CLASS=com.postgres.replic.tools.JDBCSystem
MASTER="-h $MASTER_HOST -p $MASTER_PORT -d $MASTER_DB -U $MASTER_USER"
MASTER_SU="-h $MASTER_HOST -p $MASTER_PORT -d $MASTER_DB -U $SU"
SLAVE="-h $SLAVE_HOST -p $SLAVE_PORT -d $SLAVE_DB -U $SLAVE_USER"
MASTER_J="-host $MASTER_HOST -db $MASTER_DB -port $MASTER_PORT -user $MASTER_USER -pass $MASTER_PASS"
SLAVE_J="-host $SLAVE_HOST -db $SLAVE_DB -port $SLAVE_PORT -user $SLAVE_USER  -pass $SLAVE_PASS -slave"


# export environment variables
export REPLIC_JAVA REPLIC_HOME POSTGRES_HOME REPLIC_THREADS REPLIC_RECOVER REPLIC_REPLIC REPLIC_CLEAN CLASSPATH 
export SU SQL_DIR SQL_TMP_DIR MASTER_HOST MASTER_USER MASTER_PASS MASTER_DB SLAVE_HOST SLAVE_PORT SLAVE_USER SLAVE_PASS
export SLAVE_DB SQL_GEN_CLASS MASTER MASTER_SU SLAVE MASTER_J SLAVE_J

