diff options
author | Jakub Jirutka <jakub@jirutka.cz> | 2018-05-16 00:22:13 +0200 |
---|---|---|
committer | Jakub Jirutka <jakub@jirutka.cz> | 2018-05-16 00:29:44 +0200 |
commit | c28bfa6688edf662275b96f0fec3042098f4defb (patch) | |
tree | eae74e61374527046e95837582ca41654293dfe3 /main/redis/redis-sentinel.initd | |
parent | 9eb6b73c74302111d40228d99cc9ee789b226497 (diff) | |
download | aports-c28bfa6688edf662275b96f0fec3042098f4defb.tar.bz2 aports-c28bfa6688edf662275b96f0fec3042098f4defb.tar.xz |
main/redis: add init script and config for sentinel
Ref #8877 (https://bugs.alpinelinux.org/issues/8877)
Diffstat (limited to 'main/redis/redis-sentinel.initd')
-rw-r--r-- | main/redis/redis-sentinel.initd | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/main/redis/redis-sentinel.initd b/main/redis/redis-sentinel.initd new file mode 100644 index 0000000000..f5d2a371c5 --- /dev/null +++ b/main/redis/redis-sentinel.initd @@ -0,0 +1,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}" +} |