#!/bin/sh
#
# $OpenBSD: postgresql.rc,v 1.6 2011/01/05 16:05:54 ajacoutot Exp $

daemon="/usr/local/bin/postgres"
daemon_user="_postgresql"

. /etc/rc.d/rc.subr

bin="/usr/local/bin/pg_ctl"
datadir="/var/postgresql/data"

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

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

rc_cmd $1
