#!/bin/sh
#
# $OpenBSD: postgresql.rc,v 1.8 2011/03/17 16:49:27 ajacoutot Exp $

daemon="${TRUEPREFIX}/bin/postgres"
daemon_user="_postgresql"

. /etc/rc.d/rc.subr

bin="${TRUEPREFIX}/bin/pg_ctl"
datadir="/var/postgresql/data"

rc_start() {
	rm -f ${datadir}/postmaster.pid
	${rcexec} "${bin} -D ${datadir} start -l /var/postgresql/logfile"
}

rc_stop() {
	${rcexec} "${bin} -D ${datadir} stop -m fast" || \
		${rcexec} "${bin} -D ${datadir} stop -m immediate"
}

rc_cmd $1
