diff options
author | Sergey A. Osokin <osa@FreeBSD.org> | 2015-11-07 20:08:18 +0000 |
---|---|---|
committer | Sergey A. Osokin <osa@FreeBSD.org> | 2015-11-07 20:08:18 +0000 |
commit | f14346f630589fabbf510a3c90295b5ecfa17047 (patch) | |
tree | a619188530648973fa68a5959c13650658a450c2 /databases/redis/files | |
parent | devel/rubygem-rubocop: update to 0.35.0 (diff) |
Enable profiles support.
Bump PORTREVISION.
PRs: 171372, 179551
Notes
Notes:
svn path=/head/; revision=401020
Diffstat (limited to 'databases/redis/files')
-rw-r--r-- | databases/redis/files/redis.in | 36 |
1 files changed, 36 insertions, 0 deletions
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" |