SHA256
1
0
forked from pool/redis

Accepting request 140668 from home:vjt:ifad

As requested on https://build.opensuse.org/request/show/129485 I've added the required .changes entry.

Thanks,

~Marcello

OBS-URL: https://build.opensuse.org/request/show/140668
OBS-URL: https://build.opensuse.org/package/show/server:database/redis?expand=0&rev=32
This commit is contained in:
Michal Hrusecky (old before rename to _miska_) 2012-11-20 12:09:48 +00:00 committed by Git OBS Bridge
parent ff9cd96e18
commit 4da5115e13
4 changed files with 179 additions and 81 deletions

View File

@ -1,12 +1,6 @@
--- --- redis.conf.orig 2012-07-31 16:56:02.000000000 +0200
redis.conf | 10 +++++----- +++ redis.conf 2012-07-31 16:59:31.000000000 +0200
1 file changed, 5 insertions(+), 5 deletions(-) @@ -14,11 +14,11 @@
Index: redis.conf
===================================================================
--- redis.conf.orig 2011-10-17 10:46:00.000000000 +0200
+++ redis.conf 2011-10-24 12:47:49.839930573 +0200
@@ -14,7 +14,7 @@
# By default Redis does not run as a daemon. Use 'yes' if you need it. # By default Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized. # Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
@ -15,7 +9,12 @@ Index: redis.conf
# When running daemonized, Redis writes a pid file in /var/run/redis.pid by # When running daemonized, Redis writes a pid file in /var/run/redis.pid by
# default. You can specify a custom pid file location here. # default. You can specify a custom pid file location here.
@@ -27,7 +27,7 @@ port 6379 -pidfile /var/run/redis.pid
+pidfile /var/run/redis/default.pid
# Accept connections on the specified port, default is 6379.
# If port 0 is specified Redis will not listen on a TCP socket.
@@ -27,7 +27,7 @@
# If you want you can bind a single interface, if the bind option is not # If you want you can bind a single interface, if the bind option is not
# specified all the interfaces will listen for incoming connections. # specified all the interfaces will listen for incoming connections.
# #
@ -24,7 +23,7 @@ Index: redis.conf
# Specify the path for the unix socket that will be used to listen for # Specify the path for the unix socket that will be used to listen for
# incoming connections. There is no default, so Redis will not listen # incoming connections. There is no default, so Redis will not listen
@@ -45,12 +45,12 @@ timeout 300 @@ -45,12 +45,12 @@
# verbose (many rarely useful info, but not a mess like the debug level) # verbose (many rarely useful info, but not a mess like the debug level)
# notice (moderately verbose, what you want in production probably) # notice (moderately verbose, what you want in production probably)
# warning (only very important / critical messages are logged) # warning (only very important / critical messages are logged)
@ -35,16 +34,25 @@ Index: redis.conf
# Redis to log on the standard output. Note that if you use standard # Redis to log on the standard output. Note that if you use standard
# output for logging but daemonize, logs will be sent to /dev/null # output for logging but daemonize, logs will be sent to /dev/null
-logfile stdout -logfile stdout
+logfile /var/log/redis/redis.log +logfile /var/log/redis/default.log
# To enable logging to the system logger, just set 'syslog-enabled' to yes, # To enable logging to the system logger, just set 'syslog-enabled' to yes,
# and optionally update the other syslog parameters to suit your needs. # and optionally update the other syslog parameters to suit your needs.
@@ -104,7 +104,7 @@ dbfilename dump.rdb @@ -104,7 +104,7 @@
# Also the Append Only File will be created inside this directory. # Also the Append Only File will be created inside this directory.
# #
# Note that you must specify a directory here, not a file name. # Note that you must specify a directory here, not a file name.
-dir ./ -dir ./
+dir /var/lib/redis/ +dir /var/lib/redis/default/
################################# REPLICATION ################################# ################################# REPLICATION #################################
@@ -386,7 +386,7 @@
# *** WARNING *** if you are using a shared hosting the default of putting
# the swap file under /tmp is not secure. Create a dir with access granted
# only to Redis user and configure Redis to create the swap file there.
-vm-swap-file /tmp/redis.swap
+vm-swap-file /var/lib/redis/default/redis.swap
# vm-max-memory configures the VM to use at max the specified amount of
# RAM. Everything that deos not fit will be swapped on disk *if* possible, that

View File

@ -1,39 +1,120 @@
Index: utils/redis_init_script --- utils/redis_init_script.orig 2012-07-31 16:48:33.000000000 +0200
=================================================================== +++ utils/redis_init_script 2012-11-08 17:36:19.000000000 +0100
--- utils/redis_init_script.orig 2011-10-17 10:46:00.000000000 +0200 @@ -1,42 +1,131 @@
+++ utils/redis_init_script 2011-10-24 12:47:43.108960720 +0200
@@ -1,42 +1,75 @@
#!/bin/sh #!/bin/sh
+
+# System startup script for Redis for OpenSUSE >= 11.4
+#
+# Author: Marcello Barnaba <m.barnaba@ifad.org>
+# Tue Jul 31 17:32:27 CEST 2012
+#
+# LSB-compatible service control script; see http://www.linuxbase.org/spec/
+# Install it in /etc/init.d/redis and run insserv /etc/init.d/redis
+# Define configurations in /etc/init.d/redis/NAME.conf
+#
+# Source: https://gist.github.com/804026
# #
-# Simple Redis init.d script conceived to work on Linux systems -# Simple Redis init.d script conceived to work on Linux systems
-# as it does use of the /proc filesystem. -# as it does use of the /proc filesystem.
+# /etc/init.d/redis
+#
+### BEGIN INIT INFO +### BEGIN INIT INFO
+# Provides: redis +# Provides: redis
+# Required-Start: $syslog $remote_fs +# Required-Start: $syslog $remote_fs
+# Should-Start:
+# Required-Stop: $syslog $remote_fs +# Required-Stop: $syslog $remote_fs
+# Should-Stop:
+# Default-Start: 3 5 +# Default-Start: 3 5
+# Default-Stop: 0 1 2 6 +# Default-Stop: 0 1 2 6
+# Short-Description: Redis server +# Short-Description: Redis server
+# Description: Starts and stops the Redis daemon +# Description: Starts and stops the configured Redis instances
+### END INIT INFO +### END INIT INFO
+ +
+EXEC=/usr/sbin/redis-server
+USER=redis
+STATE=/var/run/redis
+CONF=/etc/redis
+
+. /etc/rc.status +. /etc/rc.status
+
+if [ ! -d $STATE ]; then
+ install -d $state -o $USER -g $USER -m 0755 $STATE
+fi
+
+_get_env() {
+ INSTANCE=$1
+ PIDFILE=${STATE}/${INSTANCE}.pid
+ CONFIG=${CONF}/${INSTANCE}.conf
+}
+
+_foreach_config() {
+ command=$1
+
+ if [ -n "$2" ]; then
+ $command $2
+ else
+ for file in /etc/redis/*.conf; do
+ $command `basename $file | sed 's#\.conf##'` # dirty
+ done
+ fi
+}
+
+start() {
+ _get_env $1
+
+ echo -n "Starting Redis server '${INSTANCE}'... "
+
+ if [ ! -f ${CONFIG} ]; then
+ echo "$CONFIG not found"
+ rc_failed
REDISPORT=6379 -REDISPORT=6379
-EXEC=/usr/local/bin/redis-server -EXEC=/usr/local/bin/redis-server
-CLIEXEC=/usr/local/bin/redis-cli -CLIEXEC=/usr/local/bin/redis-cli
+EXEC=/usr/sbin/redis-server + elif [ -f ${PIDFILE} ] && [ -x /proc/`cat ${PIDFILE}` ]; then
+CLIEXEC=/usr/bin/redis-cli + echo -n "already running (PID `cat ${PIDFILE}`)"
+
+ else
+ rm -f ${PIDFILE}
+ sudo -u $USER $EXEC $CONFIG
+ fi
+ rc_status -v
+}
+
+stop() {
+ _get_env $1
+
+ echo -n "Stopping Redis server '${INSTANCE}' ... "
+
+ if [ ! -f $PIDFILE ]; then
+ echo -n "not running"
+ else
+ PID=`cat $PIDFILE`
+ CLI='/usr/bin/redis-cli'
+ PASS=`grep ^requirepass $CONFIG | awk '{print $2}'`
+ PORT=`grep ^port $CONFIG | awk '{print $2}'`
+
+ CLI="$CLI -p $PORT"
+ [ -n "$PASS" ] && CLI="$CLI -a $PASS"
+
+ $CLI shutdown
+ echo -n "Waiting... "
+
+ while [ -x /proc/${PID} ]; do
+ sleep 1
+ echo -n '.'
+ done
+ rm -f ${PIDFILE}
+ fi
+ rc_status -v
+}
+
+status() {
+ _get_env $1
+
+ echo -n "Checking for redis '${INSTANCE}'"
+ /sbin/checkproc -p $PIDFILE $EXEC
+ rc_status -v
+}
-PIDFILE=/var/run/redis_${REDISPORT}.pid -PIDFILE=/var/run/redis_${REDISPORT}.pid
-CONF="/etc/redis/${REDISPORT}.conf" -CONF="/etc/redis/${REDISPORT}.conf"
+CONF=/etc/redis.conf
+PIDFILE=/var/run/redis.pid
+LOGFILE=/var/log/redis/redis.log
case "$1" in case "$1" in
start) start)
@ -43,58 +124,43 @@ Index: utils/redis_init_script
- else - else
- echo "Starting Redis server..." - echo "Starting Redis server..."
- $EXEC $CONF - $EXEC $CONF
+ if [ ! -r $LOGFILE ]; then - fi
+ touch $LOGFILE - ;;
+ chown redis:redis $LOGFILE + _foreach_config start $2
+ fi + ;;
+ # Create a pidfile the server can write into. +
+ if [ ! -r $PIDFILE ]; then
+ touch $PIDFILE
+ chown redis:redis $PIDFILE
fi
+ echo -n "Starting service Redis "
+ /sbin/startproc -u redis -g redis -p $PIDFILE -s -e $EXEC $CONF >/dev/null 2>&1
+ rc_status -v
;;
stop) stop)
if [ ! -f $PIDFILE ] - if [ ! -f $PIDFILE ]
then - then
- echo "$PIDFILE does not exist, process is not running" - echo "$PIDFILE does not exist, process is not running"
+ echo -n "$PIDFILE does not exist, process is not running" - else
+ rc_failed
else
- PID=$(cat $PIDFILE) - PID=$(cat $PIDFILE)
- echo "Stopping ..." - echo "Stopping ..."
+ echo -n "Stopping service Redis..." - $CLIEXEC -p $REDISPORT shutdown
$CLIEXEC -p $REDISPORT shutdown
- while [ -x /proc/${PID} ] - while [ -x /proc/${PID} ]
+ PID=$(cat $PIDFILE) - do
+ while [ -x /proc/${PIDFILE} ]
do
- echo "Waiting for Redis to shutdown ..." - echo "Waiting for Redis to shutdown ..."
sleep 1 - sleep 1
done - done
- echo "Redis stopped" - echo "Redis stopped"
fi - fi
+ rc_status -v - ;;
;; + _foreach_config stop $2
- *) + ;;
- echo "Please use start or stop as first argument"
+ restart)
+ $0 stop
+ $0 start
;;
+ reload)
+ $0 restart
+ ;;
+ status)
+ echo -n "Checking for service Redis: "
+ /sbin/checkproc -p $PIDFILE $EXEC
+ rc_status -v
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|status|restart|reload}"
+ exit 1
esac
+rc_exit
+ +
+ status)
+ _foreach_config status $2
+ ;;
+
+ restart)
+ $0 stop $2
+ $0 start $2
+ ;;
+
*)
- echo "Please use start or stop as first argument"
- ;;
+ echo "Usage: $0 <start|stop|restart|status>"
+ exit 1
+ ;;
esac

View File

@ -1,3 +1,20 @@
-------------------------------------------------------------------
Thu Nov 8 16:12:21 UTC 2012 - vjt@openssl.it
- Implement a multi-instance setup
* Allow for multiple configuration files of named instances
under /etc/redis
* Each instance has its own data directory
under /var/lib/redis/$INSTANCE
* Each instance has its own PID file
under /var/run/redis/$INSTANCE.pid
* Each instance has its own log files
under /var/log/redis/$INSTANCE.log
* Instances may be started or stopped individually passing a
second argument to the init script
* Do not create an active default.conf, rather use an
.example suffix
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Jul 23 18:11:50 UTC 2012 - mrueckert@suse.de Mon Jul 23 18:11:50 UTC 2012 - mrueckert@suse.de

View File

@ -18,6 +18,7 @@
%define _data_dir %{_localstatedir}/lib/%{name} %define _data_dir %{_localstatedir}/lib/%{name}
%define _log_dir %{_localstatedir}/log/%{name} %define _log_dir %{_localstatedir}/log/%{name}
%define _conf_dir %{_sysconfdir}/%{name}
Name: redis Name: redis
Version: 2.4.15 Version: 2.4.15
@ -68,14 +69,16 @@ different kind of sorting abilities.
make %{?_smp_mflags} CFLAGS="%{optflags}" V=1 make %{?_smp_mflags} CFLAGS="%{optflags}" V=1
%install %install
install -d %{buildroot}%{_log_dir} %{buildroot}%{_data_dir} install -d %{buildroot}%{_log_dir} %{buildroot}%{_data_dir} %{buildroot}%{_conf_dir}
install -d %{buildroot}%{_log_dir}/default %{buildroot}%{_data_dir}/default
install -D -m 0755 src/redis-benchmark %{buildroot}%{_bindir}/redis-benchmark install -D -m 0755 src/redis-benchmark %{buildroot}%{_bindir}/redis-benchmark
install -m 0755 src/redis-cli %{buildroot}%{_bindir}/redis-cli install -m 0755 src/redis-cli %{buildroot}%{_bindir}/redis-cli
install -m 0755 src/redis-check-dump %{buildroot}%{_bindir}/redis-check-dump install -m 0755 src/redis-check-dump %{buildroot}%{_bindir}/redis-check-dump
install -m 0755 src/redis-check-aof %{buildroot}%{_bindir}/redis-check-aof install -m 0755 src/redis-check-aof %{buildroot}%{_bindir}/redis-check-aof
install -D -m 0755 src/redis-server %{buildroot}%{_sbindir}/redis-server install -D -m 0755 src/redis-server %{buildroot}%{_sbindir}/redis-server
install -D -m 0640 redis.conf %{buildroot}%{_sysconfdir}/redis.conf
install -D -m 0640 redis.conf %{buildroot}%{_conf_dir}/default.conf.example
## install -Dp -m 0755 %{SOURCE4} %{buildroot}%{_sysconfdir}/sysconfig/redis ## install -Dp -m 0755 %{SOURCE4} %{buildroot}%{_sysconfdir}/sysconfig/redis
# #
@ -107,7 +110,9 @@ make test && true
%post %post
%fillup_and_insserv %{name} %fillup_and_insserv %{name}
%restart_on_update %{name} %restart_on_update %{name}
echo "To start the database server, do:" echo "To start the database server, create your configuration"
echo "starting from /etc/redis/default.conf.example, place it"
echo "in /etc/redis and do: "
echo " sudo rcredis start; sudo insserv redis" echo " sudo rcredis start; sudo insserv redis"
%preun %preun
@ -125,8 +130,10 @@ echo " sudo rcredis start; sudo insserv redis"
%{_sbindir}/redis-* %{_sbindir}/redis-*
%{_sbindir}/rc%{name} %{_sbindir}/rc%{name}
%config(noreplace) %{_sysconfdir}/init.d/redis %config(noreplace) %{_sysconfdir}/init.d/redis
%config(noreplace) %attr(0640, %{name}, %{name}) %{_sysconfdir}/redis.conf %config(noreplace) %attr(0640, %{name}, %{name}) %{_conf_dir}/default.conf.example
%dir %attr(0750, %{name}, %{name}) %{_data_dir} %dir %attr(0750, %{name}, %{name}) %{_data_dir}
%dir %attr(0750, %{name}, %{name}) %{_data_dir}/default
%dir %attr(0750, %{name}, %{name}) %{_log_dir} %dir %attr(0750, %{name}, %{name}) %{_log_dir}
%dir %attr(0750, %{name}, %{name}) %{_conf_dir}
%changelog %changelog