ports/databases/mongodb34-rocks/files/mongos.in
Thomas Zander bb9eafeba3 Fix initial startup: Create missing /var/run/mongodb folder
PR:		219700
Submitted by:	numisemis@yahoo.com (maintainer)
MFH:		2017Q3
2017-07-16 13:00:10 +00:00

60 lines
1.7 KiB
Bash

#!/bin/sh
# PROVIDE: mongos
# REQUIRE: NETWORK ldconfig
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# mongos_enable (bool): Set to "NO" by default.
# Set it to "YES" to enable mongos.
# mongos_limits (bool): Set to "NO" by default.
# Set it to yes to run `limits -e -U mongodb`
# just before mongos starts.
# mongos_flags (str): Custom additional arguments to be passed to mongos.
# Default to "--logpath /var/log/mongodb/mongos.log --logappend".
# mongos_config (str): Default to "%%PREFIX%%/etc/mongos.conf"
# Path to config file
#
. /etc/rc.subr
name="mongos"
rcvar=mongos_enable
load_rc_config $name
: ${mongos_enable="NO"}
: ${mongos_limits="NO"}
: ${mongos_logpath="/var/log/mongodb"}
: ${mongos_runpath="/var/run/mongodb"}
: ${mongos_flags="--logpath ${mongos_logpath}/mongos.log --logappend"}
: ${mongos_user="mongodb"}
: ${mongos_group="mongodb"}
: ${mongos_config="%%PREFIX%%/etc/mongos.conf"}
pidfile="${mongos_runpath}/mongos.pid"
command=%%PREFIX%%/bin/${name}
command_args="--config $mongos_config --fork >/dev/null 2>/dev/null"
start_precmd="${name}_prestart"
mongos_create_dbpath()
{
install -d -g ${mongos_group} -o ${mongos_user} -m 755 ${mongos_logpath}
install -d -g ${mongos_group} -o ${mongos_user} -m 755 ${mongos_runpath}
}
mongos_prestart()
{
if [ ! -d ${mongos_logpath} ]; then
mongos_create_dbpath || return 1
fi
if checkyesno mongos_limits; then
eval `/usr/bin/limits -e -U ${mongos_user}` 2>/dev/null
else
return 0
fi
}
run_rc_command "$1"