summaryrefslogtreecommitdiff
path: root/net-mgmt/rubygem-oxidized/files/oxidized.in
blob: 67efb39068dd178bc79a0d7070a1916ccf5571af (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
#!/bin/sh

# PROVIDE: oxidized
# REQUIRE: LOGIN
# KEYWORD: shutdown

#
# Configuration settings for oxidized in /etc/rc.conf:
#
# oxidized_enable (bool):
#   Set to "NO" by default.
#   Set it to "YES" to enable oxidized
#
# oxidized_args (str):
#   Extra arguments passed to start command
#
# oxidized_home (str)
#   Set to "/var/db/oxidized" by default.
#   Set the OXIDIZED_HOME variable for oxidized process
#
# oxidized_user (str):
#   Set to "oxidized" by default.
#   User to run oxidized as.
#
# oxidized_group (str):
#   Set to "oxidized" by default.
#   Group for data file ownership.
#

. /etc/rc.subr

name="oxidized"
rcvar=oxidized_enable

load_rc_config "${name}"

: ${oxidized_enable="NO"}
: ${oxidized_home="/var/db/oxidized"}
: ${oxidized_args=""}
: ${oxidized_user="oxidized"}
: ${oxidized_group="oxidized"}

piddir="/var/run/${name}"
pidfile="${piddir}/${name}.pid"
procname=%%RUBY%%
command="/usr/sbin/daemon"
command_args="-f -p ${pidfile} %%PREFIX%%/bin/oxidized ${oxidized_args}"

export HOME=${oxidized_home}

start_precmd="oxidized_prestart"

oxidized_prestart() {
	if [ ! -d ${piddir} ]; then
		install -d -o "${oxidized_user}" -g "${oxidized_group}" -m 750 ${piddir}
	fi
}

run_rc_command "$1"