mirror of
https://git.FreeBSD.org/ports.git
synced 2025-01-07 06:40:06 +00:00
826af1967d
While on it: - Pet portlint PR: 227221 Submitted by: 0mp Approved by: maintainer timeout
87 lines
2.9 KiB
Bash
87 lines
2.9 KiB
Bash
#!/bin/sh
|
|
|
|
# PROVIDE: arangod
|
|
# REQUIRE: NETWORK ldconfig
|
|
# KEYWORD: shutdown
|
|
#
|
|
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
|
|
# to enable this service:
|
|
#
|
|
# arangod_enable (bool): Set to "NO" by default.
|
|
# Set it to "YES" to enable arangod.
|
|
%%LEGACY_LIMITS%%# arangod_limits (bool): Set to "NO" by default.
|
|
%%LEGACY_LIMITS%%# Set it to yes to run `limits -e -U arangodb`
|
|
%%LEGACY_LIMITS%%# just before arangod starts.
|
|
# arangod_dbpath (str): Default to "/var/db/arangodb"
|
|
# Base database directory.
|
|
# arangod_logpath (str): Default to "/var/log/arangodb"
|
|
# Base logging directory
|
|
# arangod_apppath (str): Default to "/var/db/arangodb-apps"
|
|
# Base apps directory
|
|
# arangod_flags (str): Custom additional arguments to be passed to arangod.
|
|
# Default to "".
|
|
# arangod_config (str): Default to "%%PREFIX%%/etc/arangodb/arangod.conf"
|
|
# Path to config file
|
|
#
|
|
|
|
. /etc/rc.subr
|
|
|
|
name="arangod"
|
|
rcvar=arangod_enable
|
|
|
|
load_rc_config $name
|
|
|
|
: ${arangod_enable="NO"}
|
|
%%LEGACY_LIMITS%%: ${arangod_limits="NO"}
|
|
: ${arangod_dbpath="/var/db/arangodb"}
|
|
: ${arangod_logpath="/var/log/arangodb"}
|
|
: ${arangod_apppath="/var/db/arangodb-apps"}
|
|
: ${arangod_flags=""}
|
|
: ${arangod_user="arangodb"}
|
|
: ${arangod_group="arangodb"}
|
|
: ${arangod_config="%%PREFIX%%/etc/arangodb/arangod.conf"}
|
|
|
|
pidfile="${arangod_dbpath}/arangod.lock"
|
|
command=%%PREFIX%%/sbin/${name}
|
|
command_args="--configuration $arangod_config --database.directory $arangod_dbpath --log.output ${arangod_logpath}/arangod.log --javascript.app-path ${arangod_apppath} --daemon --pid-file ${pidfile} >/dev/null 2>/dev/null"
|
|
start_precmd="${name}_prestart"
|
|
|
|
arangod_create_dbpath()
|
|
{
|
|
mkdir ${arangod_dbpath} >/dev/null 2>/dev/null
|
|
[ $? -eq 0 ] && chown -R ${arangod_user}:${arangod_group} ${arangod_dbpath}
|
|
}
|
|
|
|
arangod_create_logpath()
|
|
{
|
|
mkdir ${arangod_logpath} >/dev/null 2>/dev/null
|
|
[ $? -eq 0 ] && chown -R ${arangod_user}:${arangod_group} ${arangod_logpath}
|
|
}
|
|
|
|
arangod_create_apppath()
|
|
{
|
|
mkdir ${arangod_apppath} >/dev/null 2>/dev/null
|
|
[ $? -eq 0 ] && chown -R ${arangod_user}:${arangod_group} ${arangod_apppath}
|
|
}
|
|
|
|
arangod_prestart()
|
|
{
|
|
if [ ! -d ${arangod_dbpath} ]; then
|
|
arangod_create_dbpath || return 1
|
|
fi
|
|
if [ ! -d ${arangod_logpath} ]; then
|
|
arangod_create_logpath || return 1
|
|
fi
|
|
if [ ! -d ${arangod_apppath} ]; then
|
|
arangod_create_apppath || return 1
|
|
fi
|
|
%%LEGACY_LIMITS%% if checkyesno arangod_limits; then
|
|
%%LEGACY_LIMITS%% eval `/usr/bin/limits -e -U ${arangod_user}` 2>/dev/null
|
|
%%LEGACY_LIMITS%% else
|
|
%%LEGACY_LIMITS%% return 0
|
|
%%LEGACY_LIMITS%% fi
|
|
%%MODERN_LIMITS%% return 0
|
|
}
|
|
|
|
run_rc_command "$1"
|