openbsd-ports/net/rabbitmq/pkg/rabbitmq.rc
sthen 91faa22c52 Where a program with an rc script _requires_ a certain command line
parameter to daemonize, move the parameter from daemon to daemon_flags,
so that the user cannot inadvertently prevent it from daemonizing by
adjusting the flags.

Discussed with ajacoutot and schwarze, this method was suggested
by schwarze@ as a simpler alternative to my diff. ok aja@
2011-12-17 22:01:12 +00:00

26 lines
454 B
Bash

#!/bin/sh
#
# $OpenBSD: rabbitmq.rc,v 1.4 2011/12/17 22:01:13 sthen Exp $
daemon="${TRUEPREFIX}/sbin/rabbitmq-server -detached"
daemon_user="_rabbitmq"
. /etc/rc.d/rc.subr
rc_reload=NO
rc_pre() {
install -d -o ${daemon_user} /var/run/rabbitmq
}
rc_check() {
# return 1 is needed: rabbitmqctl returns a higher error code on failure
${TRUEPREFIX}/sbin/rabbitmqctl status || return 1
}
rc_stop() {
${TRUEPREFIX}/sbin/rabbitmqctl stop
}
rc_cmd $1