aboutsummaryrefslogtreecommitdiffstats
path: root/databases/redis
diff options
context:
space:
mode:
authorosa <osa@FreeBSD.org>2015-11-08 04:08:18 +0800
committerosa <osa@FreeBSD.org>2015-11-08 04:08:18 +0800
commit6c622703e67556216450d716ba33a73a26136d24 (patch)
treea619188530648973fa68a5959c13650658a450c2 /databases/redis
parent8d0c13591d240fff2822cb0e26e863ee9e1ddc33 (diff)
downloadfreebsd-ports-gnome-6c622703e67556216450d716ba33a73a26136d24.tar.gz
freebsd-ports-gnome-6c622703e67556216450d716ba33a73a26136d24.tar.zst
freebsd-ports-gnome-6c622703e67556216450d716ba33a73a26136d24.zip
Enable profiles support.
Bump PORTREVISION. PRs: 171372, 179551
Diffstat (limited to 'databases/redis')
-rw-r--r--databases/redis/Makefile2
-rw-r--r--databases/redis/files/redis.in36
2 files changed, 37 insertions, 1 deletions
diff --git a/databases/redis/Makefile b/databases/redis/Makefile
index b6650d5233c6..e01ec0bdbb79 100644
--- a/databases/redis/Makefile
+++ b/databases/redis/Makefile
@@ -3,7 +3,7 @@
PORTNAME= redis
DISTVERSION= 3.0.5
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= databases
MASTER_SITES= http://download.redis.io/releases/
diff --git a/databases/redis/files/redis.in b/databases/redis/files/redis.in
index ec47419e58c1..fb54f40bf2b3 100644
--- a/databases/redis/files/redis.in
+++ b/databases/redis/files/redis.in
@@ -12,6 +12,11 @@
#
#redis_enable="YES"
#
+# Define profiles here to run separate redis instances:
+#
+#redis_profiles="foo bar" # Script uses %%PREFIX%%/etc/redis-NAME.conf respectively.
+# For correct script working please update pidfile entries in
+# redis-NAME.conf files.
. /etc/rc.subr
@@ -31,4 +36,35 @@ load_rc_config "$name"
command_args="${redis_config}"
required_files="${redis_config}"
+
+_profile_exists() {
+ for _p in ${redis_profiles}; do
+ [ "${_p}" = "$1" ] && return 1;
+ done
+ return 0
+}
+
+if [ $# -eq 2 ]; then
+ _profile=$2
+ _profile_exists $_profile
+ _exists=$?
+ [ ${_exists} -ne 1 ] && {
+ echo "`basename %%PREFIX%%/etc/rc.d/redis`: no '$2' in 'redis_profiles'"
+ exit 1
+ };
+ echo "-- Profile: ${_profile} --"
+ config_file="%%PREFIX%%/etc/${name}-${_profile}.conf"
+ command_args="${config_file}"
+ pidfile="%%REDIS_RUNDIR%%/${_profile}.pid"
+ required_files="${config_file}"
+elif [ -n "${redis_profiles}" ]; then
+ _swap=$*; shift; _profiles=$*
+ _profiles=${_profiles:-${redis_profiles}}
+ set -- ${_swap}
+ for _profile in ${_profiles}; do
+ %%PREFIX%%/etc/rc.d/redis $1 ${_profile}
+ done
+ exit 0
+fi
+
run_rc_command "$1"