blob: ec940321b1cd0b28d8508ec394df202d1d8206a6 (
plain) (
blame)
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
|
#!/bin/sh
# PROVIDE: valkeysentinel
# REQUIRE: LOGIN
# BEFORE: securelevel
# KEYWORD: shutdown
# Add the following line to /etc/rc.conf to enable `valkeysentinel':
#
#valkeysentinel_enable="YES"
#
. /etc/rc.subr
name="valkeysentinel"
rcvar="$valkeysentinel_enable"
command="/usr/local/bin/valkey-sentinel"
pidfile="/var/run/valkey/valkey-sentinel.pid"
# read configuration and set defaults
load_rc_config "$name"
: ${valkeysentinel_enable="NO"}
: ${valkeysentinel_user="valkey"}
: ${valkeysentinel_config="/usr/local/etc/valkey-sentinel.conf"}
command_args="${valkeysentinel_config} --daemonize yes --pidfile ${pidfile}"
required_files="${valkeysentinel_config}"
start_precmd="valkeysentinel_checks"
restart_precmd="valkeysentinel_checks"
valkeysentinel_checks()
{
if [ x`id -u ${valkeysentinel_user}` != x`stat -f %u ${valkeysentinel_config}` ]; then
err 1 "${valkeysentinel_config} must be owned by user ${valkeysentinel_user}"
fi
}
run_rc_command "$1"
|