blob: 3163991ed7445e277b8e22a07db53f095b5b71fc (
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
|
#!/bin/sh
# PROVIDE: rtgpoll
# REQUIRE: LOGIN mysql
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# rtgpoll_enable (bool): Set to NO by default.
# Set it to YES to enable rtgpoll.
# rtgpoll_config (path): Set to %%PREFIX%%/etc/rtg/rtg.conf by default.
# rtgpoll_targets (path): Set to %%PREFIX%%/etc/rtg/targets.cfg by default.
# rtgpoll_pidfile (path): Set to /var/run/rtgpoll.pid by default.
#
. /etc/rc.subr
name="rtgpoll"
rcvar=rtgpoll_enable
start_precmd="${name}_prestart"
command="%%PREFIX%%/bin/${name}"
load_rc_config ${name}
: ${rtgpoll_enable="NO"}
: ${rtgpoll_config="%%PREFIX%%/etc/rtg/rtg.conf"}
: ${rtgpoll_targets="%%PREFIX%%/etc/rtg/targets.cfg"}
: ${rtgpoll_pidfile="/var/run/${name}.pid"}
: ${rtgpoll_user="rtg"}
: ${rtgpoll_group="rtg"}
required_files="${rtgpoll_targets}"
command_args="-b -p ${rtgpoll_pidfile} -c ${rtgpoll_config} -t ${rtgpoll_targets}"
rtgpoll_prestart()
{
chown -R "${rtgpoll_user}:${rtgpoll_group}" "%%PREFIX%%/etc/rtg"
chmod -R u+rwX,g+rX "%%PREFIX%%/etc/rtg"
}
run_rc_command "$1"
|