SHA256
1
0
forked from pool/redis
Pavol Rusnak 2010-03-07 23:11:23 +00:00 committed by Git OBS Bridge
parent 2f241e8390
commit 52aeaa5c1e
4 changed files with 68 additions and 14 deletions

13
redis-conf.patch Normal file
View File

@ -0,0 +1,13 @@
Index: redis.conf
===================================================================
--- redis.conf.orig
+++ redis.conf
@@ -2,7 +2,7 @@
# 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.
-daemonize no
+daemonize yes
# When run as a daemon, Redis write a pid file in /var/run/redis.pid by default.
# You can specify a custom pid file location here.

View File

@ -2,7 +2,7 @@ Index: utils/redis_init_script
===================================================================
--- utils/redis_init_script.orig
+++ utils/redis_init_script
@@ -1,7 +1,18 @@
@@ -1,28 +1,39 @@
#!/bin/sh
+### BEGIN INIT INFO
+# Provides: redis
@ -13,29 +13,56 @@ Index: utils/redis_init_script
+# Default-Start: 3 5
+# Default-Stop: 0 1 2 6
+# Short-Description: Redis server
+# Description: Starts the Redis server
+# Description: Manages the Redis server
+### END INIT INFO
REDISPORT=6379
-EXEC=/usr/local/bin/redis-server
+EXEC=/usr/sbin/redis-server
PIDFILE=/var/run/redis_${REDISPORT}.pid
CONF="/etc/redis/${REDISPORT}.conf"
@@ -22,7 +33,7 @@ case "$1" in
echo -n "$PIDFILE does not exist, process is not running\n"
-PIDFILE=/var/run/redis_${REDISPORT}.pid
-CONF="/etc/redis/${REDISPORT}.conf"
+PIDFILE=/var/run/redis.pid
+CONF=/etc/redis.conf
case "$1" in
start)
if [ -f $PIDFILE ]
then
- echo -n "$PIDFILE exists, process is already running or crashed\n"
+ echo "$PIDFILE exists, process is already running or crashed"
else
echo -n "Stopping ...\n"
- echo -n "Starting Redis server...\n"
+ echo "Starting Redis server..."
$EXEC $CONF
fi
;;
stop)
if [ ! -f $PIDFILE ]
then
- echo -n "$PIDFILE does not exist, process is not running\n"
+ echo "$PIDFILE does not exist, process is not running"
else
- echo -n "Stopping ...\n"
- echo -n "SHUTDOWN\r\n" | nc localhost $REDISPORT &
+ echo -n "SHUTDOWN\r\n" | netcat localhost $REDISPORT &
+ echo "Stopping ..."
+ echo -e "SHUTDOWN\r" | netcat localhost $REDISPORT &
PID=$(cat $PIDFILE)
while [ -x /proc/${PIDFILE} ]
do
@@ -33,4 +44,7 @@ case "$1" in
@@ -33,4 +44,15 @@ case "$1" in
echo "Redis stopped"
fi
;;
+ *)
+ echo "Usage: $0 [start|stop]"
+ status)
+ if [ ! -f $PIDFILE ]
+ then
+ echo "$PIDFILE does not exist, process is not running"
+ else
+ echo "$PIDFILE does exist, process is running"
+ fi
+ ;;
+ *)
+ echo "Usage: $0 [start|stop|status]"
+ ;;
esac

View File

@ -2,6 +2,7 @@
Sun Mar 7 17:21:53 UTC 2010 - prusnak@suse.cz
- updated to 1.2.4
- install config file, more fixes to initscript
-------------------------------------------------------------------
Fri Mar 5 06:12:24 EST 2010 - pzb@suse.de

View File

@ -23,6 +23,7 @@ Group: Productivity/Databases/Servers
Summary: Persistent key-value database with built-in net interface
Source: http://redis.googlecode.com/files/%{name}-%{version}.tar.gz
Patch0: %{name}-initscript.patch
Patch1: %{name}-conf.patch
# for init script
Requires: netcat
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@ -35,9 +36,17 @@ with atomic operations to push/pop elements, add/remove elements, perform server
side union, intersection, difference between sets, and so forth. Redis supports
different kind of sorting abilities.
%package doc
Summary: HTML documentation for Redis
Requires: redis = %{version}
%description doc
HTML documentation for Redis
%prep
%setup -q
%patch0
%patch1
mv doc html
%build
@ -49,19 +58,23 @@ install -D -m 0755 redis-cli $RPM_BUILD_ROOT%{_bindir}/redis-cli
install -D -m 0755 redis-server $RPM_BUILD_ROOT%{_sbindir}/redis-server
install -D -m 0755 utils/redis_init_script $RPM_BUILD_ROOT%{_sysconfdir}/init.d/redis
ln -s %{_sysconfdir}/init.d/redis $RPM_BUILD_ROOT%{_sbindir}/rcredis
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/redis
install -D -m 0644 redis.conf $RPM_BUILD_ROOT%{_sysconfdir}/redis.conf
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%doc 00-RELEASENOTES BETATESTING.txt BUGS COPYING Changelog README TODO html/
%doc 00-RELEASENOTES BETATESTING.txt BUGS COPYING Changelog README TODO
%{_bindir}/redis-benchmark
%{_bindir}/redis-cli
%{_sbindir}/redis-server
%{_sysconfdir}/init.d/redis
%{_sbindir}/rcredis
%dir %{_sysconfdir}/redis
%config(noreplace) %{_sysconfdir}/redis.conf
%files doc
%defattr(-,root,root)
%doc html/
%changelog