#!/bin/sh
#
# $FreeBSD: ports/databases/pgcluster/files/pgreplicate.in,v 1.2 2007/07/26 16:05:04 rafan Exp $
#
# PROVIDE: pgreplicate
# REQUIRE: DAEMON
# BEFORE:  pglb
#
# Add the following line to /etc/rc.conf to enable pgreplicate:
#
# pgreplicate_enable="YES"
#

. /etc/rc.subr

name="pgreplicate"
rcvar=`set_rcvar`

command=/usr/local/bin/${name}

load_rc_config $name

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

pgreplicate_user=pgsql
pgreplicate_flags="${pgreplicate_flags} -D ${pgreplicate_data}"
pidfile="${pgreplicate_data}/${name}.pid"

stop_cmd="pgreplicate_stop"

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

run_rc_command "$1"
