mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-04-12 14:56:53 +02:00
38 lines
792 B
Bash
38 lines
792 B
Bash
#!/sbin/openrc-run
|
|
|
|
name="KeyDB Sentinel"
|
|
|
|
: ${cfgfile:="/etc/keydb/sentinel.conf"}
|
|
: ${command_user:="keydb:keydb"}
|
|
|
|
command="/usr/bin/keydb-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 keydb
|
|
provide redis-sentinel
|
|
}
|
|
|
|
start_pre() {
|
|
# Sets start-start-daemon's --chdir.
|
|
directory="$(config_get 'dir' '/var/lib/keydb')" || return 1
|
|
|
|
local logfile="$(config_get 'logfile')"
|
|
if [ "$logfile" ]; then
|
|
checkpath -f -o "$command_user" "$logfile" || return 1
|
|
fi
|
|
}
|
|
|
|
config_get() {
|
|
local key="$1"
|
|
local default="${2:-}"
|
|
|
|
local value="$(awk "\$1 == \"$key\" { print \$2 }" "$cfgfile")"
|
|
printf '%s\n' "${value:-$default}"
|
|
}
|