Added
Link Here
|
1 |
#!/bin/sh |
2 |
|
3 |
# PROVIDE: sentinel |
4 |
# REQUIRE: LOGIN |
5 |
# BEFORE: securelevel |
6 |
# KEYWORD: shutdown |
7 |
|
8 |
# Add the following line to /etc/rc.conf to enable `sentinel': |
9 |
# |
10 |
#sentinel_enable="YES" |
11 |
# |
12 |
|
13 |
. /etc/rc.subr |
14 |
|
15 |
name="sentinel" |
16 |
rcvar="${name}_enable" |
17 |
|
18 |
command="/usr/local/bin/redis-sentinel" |
19 |
pidfile="/var/run/redis/$name.pid" |
20 |
|
21 |
# read configuration and set defaults |
22 |
load_rc_config "$name" |
23 |
: ${sentinel_enable="NO"} |
24 |
: ${sentinel_user="redis"} |
25 |
: ${sentinel_config="/usr/local/etc/$name.conf"} |
26 |
|
27 |
command_args="${sentinel_config} --daemonize yes --pidfile ${pidfile}" |
28 |
required_files="${sentinel_config}" |
29 |
start_precmd="${name}_checks" |
30 |
restart_precmd="${name}_checks" |
31 |
|
32 |
sentinel_checks() |
33 |
{ |
34 |
if [ x`id -u ${sentinel_user}` != x`stat -f %u ${sentinel_config}` ]; then |
35 |
err 1 "${sentinel_config} must be owned by user ${sentinel_user}" |
36 |
fi |
37 |
} |
38 |
|
39 |
run_rc_command "$1" |