#!/bin/bash
# 
# Open replicator script for PostgreSQL WAL shipping. 
#
# Copyright (c) 2009 Continuent, Inc.  All rights reserved.

# Check for ruby.  
RUBY=`which ruby 2> /dev/null`
if [ "$RUBY" = "" -o ! -x "$RUBY" ]; then
  echo "Your system does not appear to have a ruby interpreter installed"
  echo "Please install ruby and ensure that 'ruby --version' works"
  exit 1
fi

# Make sure we are in the Tungsten Replicator directory. 
BINDIR=`dirname $0`
REPLICATOR_HOME=`cd $BINDIR/../..; pwd`

# Run the WAL Mgr script. 
$RUBY -I$REPLICATOR_HOME/lib/ruby -I$REPLICATOR_HOME/../cluster-home/lib/ruby $REPLICATOR_HOME/lib/ruby/pg-wal-wrapper.rb $0 $*
