blob: 5566af9d66165255286b5f832d67272f337ab4b8 (
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
|
#!/bin/sh
# PROVIDE: barnyard2
# REQUIRE: DAEMON%%MYSQL%%%%PGSQL%%
#
# Add the following lines to /etc/rc.conf to enable barnyard2:
# barnyard2_enable (bool): Set to YES to enable barnyard2
# Default: NO
# barnyard2_flags (str): Extra flags passed to barnyard2
# Default: -D
# barnyard2_conf (str): Barnyard configuration file
# Default: %%PREFIX%%/etc/barnyard2.conf
# optional, multi-barnyard2:
# barnyard2_rules="1 2 3"
# barnyard2_1_flags="-D"
# barnyard2_1_pidfile=""
# #$command $flags $args
#
# USAGE: barnyard2 [-options]
. /etc/rc.subr
name="barnyard2"
rcvar=barnyard2_enable
load_rc_config $name
# set some defaults
: ${barnyard2_enable="NO"}
: ${barnyard2_conf="%%PREFIX%%/etc/barnyard2.conf"}
: ${barnyard2_flags="-D"}
command="%%PREFIX%%/bin/barnyard2"
command_args="-c ${barnyard2_conf} -D"
if [ -n "${barnyard2_rules}" ];then
_1=$1
rc=0
if [ $# -gt 1 ];then shift; barnyard2_rules=$*; fi
for i in ${barnyard2_rules}; do
echo -n "$i:"
eval barnyard2_flags=\$barnyard2_${i}_flags
eval pidfile=\$barnyard2_${i}_pidfile
eval barnyard2_conf=\$barnyard2_${i}_conf
command_args="-c $barnyard2_conf -D"
run_rc_command "$_1"
if [ $? -ne 0 ];then rc=1 ; fi
unset _pidcmd _rc_restart_done
done
else
run_rc_command "$1"
fi
|