#!/bin/sh
#
# $FreeBSD: ports/databases/pgcluster/files/pgreplicate.sh.tmpl,v 1.3 2004/07/26 23:28:47 kuriyama Exp $
#
# PROVIDE: pgreplicate
# REQUIRE: DAEMON
# BEFORE:  pglb
# KEYWORD: FreeBSD
#
# Add the following line to /etc/rc.conf to enable pgreplicate:
#
# pgreplicate_enable="YES"
#

pgreplicate_enable=${pgreplicate_enable-"NO"}
pgreplicate_data=${pgreplicate_data-"/usr/local/pgsql/data"}

. /etc/rc.subr

load_rc_config pgreplicate

name=pgreplicate
rcvar=`set_rcvar`
command=/usr/local/bin/pgreplicate
pgreplicate_user=pgsql
stop_cmd="pgreplicate_stop"

pgreplicate_flags="${pgreplicate_flags} -D ${pgreplicate_data}"
pidfile="${pgreplicate_data}/pgreplicate.pid"

pgreplicate_stop()
{
    su -m ${pgreplicate_user} -c "exec ${command} -D ${pgreplicate_data} stop"
}

load_rc_config $name
run_rc_command "$1"
