blob: e99ac3c9fd6b5abe80394b1c1354345fdac0f941 (
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
|
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: monitorix
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: shutdown
. /etc/rc.subr
name=monitorix
rcvar=monitorix_enable
load_rc_config $name
: ${monitorix_enable:=NO}
start_cmd="${name}_start"
start_precmd=monitorix_check_rrds
pidfile="/var/run/${name}.pid"
command_interpreter=.
procname="%%PREFIX%%/bin/${name}"
monitorix_check_rrds()
{
baselib=`grep ^base_lib %%PREFIX%%/etc/monitorix.conf`
baselib=${baselib##*= }
if [ "$baselib" = "%%DATADIR%%/" ]; then
err 1 "Please update your monitorix.conf, replacing the base_lib value with %%DBDIR%%/ (note trailing slash)."
fi
}
monitorix_start()
{
if [ -z "$rc_fast" -a -n "$rc_pid" ]; then
echo 1>&2 "${name} already running? (pid=$rc_pid)."
return 1
fi
echo "Starting ${name}."
rc_flags="-c %%PREFIX%%/etc/${name}.conf -p ${pidfile} ${rc_flags}"
/usr/bin/env PATH="$PATH:%%PREFIX%%/sbin:%%PREFIX%%/bin" perl %%PREFIX%%/bin/${name} ${rc_flags} ${command_args}
}
run_rc_command "$1"
|