aboutsummaryrefslogtreecommitdiffstats
path: root/main/redis/redis-sentinel.initd
blob: f5d2a371c53f3b73f49c0164ce160cb2a9288cfc (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
#!/sbin/openrc-run

name="Redis Sentinel"

: ${cfgfile:="/etc/sentinel.conf"}
: ${command_user:="redis:redis"}
: ${retry:=30}

command="/usr/bin/redis-sentinel"
command_args="$cfgfile --daemonize no $command_args"
command_background="yes"

pidfile="/run/$RC_SVCNAME.pid"

required_files="$cfgfile"

depend() {
	use net localmount logger
	after keepalived firewall redis
}

start_pre() {
	# Sets start-start-daemon's --chdir.
	directory=$(config_get 'dir' '/var/lib/redis')
}

config_get() {
	local key="$1"
	local default="${2:-}"

	local value=$(awk "\$1 == \"$key\" { print \$2 }" "$cfgfile")
	printf '%s\n' "${value:-$default}"
}