#!/bin/ksh
#
# $OpenBSD: postgresql.rc,v 1.13 2019/08/27 19:49:46 awolk Exp $

daemon="${TRUEPREFIX}/bin/pg_ctl"
daemon_flags="-D /var/postgresql/data -w -l /var/postgresql/logfile"
daemon_user="_postgresql"

. /etc/rc.d/rc.subr

rc_usercheck=NO

rc_check() {
	${rcexec} "${daemon} status ${daemon_flags}"
}

rc_reload() {
	${rcexec} "${daemon} reload ${daemon_flags}"
}

rc_start() {
	${rcexec} "${daemon} start ${daemon_flags}"
}

rc_stop() {
	${rcexec} "${daemon} stop ${daemon_flags} -m fast" || \
		${rcexec} "${daemon} stop ${daemon_flags} -m immediate"
}

rc_cmd $1
