summaryrefslogtreecommitdiff
path: root/net-mgmt/riemann/files/riemann.in
blob: e48f4bbe4d4571690c54d87eaa5647418e02582a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/sh

# $FreeBSD$
#
# PROVIDE: riemann
# REQUIRE: LOGIN NETWORKING SERVERS
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# riemann_enable    (bool):   Set to NO by default.
# Set it to YES to enable riemann.
#
# riemann_config          (string): Optional full path for riemann config file
# riemann_user            (user):   Set to riemann by default.
# riemann_group           (group):  Set to riemann by default.
# riemann_jarfile         (string): Optional path to a custom jarfile.
# riemann_java_home       (args):   Specify which JVM to use, if not default.
# riemann_java_classpath  (args):   Specify a custom Java ClassPath.
# riemann_min_mem         (num):    Minumum JVM heap size, 256m by default.
# riemann_max_mem         (num):    Maximum JVM heap size, 1g by default.
# riemann_java_opts       (args):   Additional JVM properties or arguments.

. /etc/rc.subr

name="riemann"
rcvar=riemann_enable

load_rc_config $name

: ${riemann_enable="NO"}
: ${riemann_user:="riemann"}
: ${riemann_group:="riemann"}
: ${riemann_config:="%%ETCDIR%%/riemann.config"}
: ${riemann_jarfile:="%%JAVAJARDIR%%/riemann.jar"}
: ${riemann_java_home:="%%JAVA_HOME%%"}
: ${riemann_min_mem:="256m"}
: ${riemann_max_mem:="1g"}
: ${riemann_java_classpath:=${riemann_jarfile}}
: ${riemann_java_opts:=" -server \
	-cp ${riemann_java_classpath} \
        -Dapp=riemann \
        -Xms${riemann_min_mem} \
        -Xmx${riemann_max_mem} \
        -Xss256k \
        -Djava.awt.headless=true \
        -XX:+AggressiveOpts \
        -XX:+CMSClassUnloadingEnabled \
        -XX:+CMSParallelRemarkEnabled \
        -XX:+DisableExplicitGC \
        -XX:+HeapDumpOnOutOfMemoryError \
        -XX:+UseCMSInitiatingOccupancyOnly \
        -XX:+UseCompressedOops \
        -XX:+UseConcMarkSweepGC \
        -XX:+UseFastAccessorMethods \
        -XX:+UseParNewGC \
        -XX:CMSInitiatingOccupancyFraction=75 "}

pidfile="/var/run/riemann.pid"
start_precmd="install -o ${riemann_user} /dev/null ${pidfile}"

command="/usr/sbin/daemon"
command_args=" \
	-c \
	-t riemann \
	-r \
	-P ${pidfile} \
	${riemann_java_home}/bin/java \
	${riemann_java_opts} \
	riemann.bin start ${riemann_config}"

required_files="${java_cmd} ${riemann_config}"

# support SIGHUP to reload config file using pkill. parent pid
# is that of daemon(8) and not of riemann's JVM instance
extra_commands="reload"
reload_cmd="pkill -SIGHUP -U ${riemann_user} -G ${riemann_group} -f Dapp=riemann"

run_rc_command "$1"