diff --git a/redis-initscript.patch b/redis-initscript.patch index f740322..3e4c200 100644 --- a/redis-initscript.patch +++ b/redis-initscript.patch @@ -2,7 +2,7 @@ Index: utils/redis_init_script =================================================================== --- utils/redis_init_script.orig +++ utils/redis_init_script -@@ -1,28 +1,44 @@ +@@ -1,36 +1,67 @@ #!/bin/sh +### BEGIN INIT INFO +# Provides: redis @@ -26,6 +26,8 @@ Index: utils/redis_init_script +CONF=/etc/redis.conf + +. /etc/rc.status ++ ++rc_reset case "$1" in start) @@ -36,8 +38,9 @@ Index: utils/redis_init_script + rc_failed else - echo -n "Starting Redis server...\n" +- $EXEC $CONF + echo -n "Starting Redis server..." - $EXEC $CONF ++ $EXEC $CONF > /dev/null + rc_status -v fi ;; @@ -50,28 +53,28 @@ Index: utils/redis_init_script else - echo -n "Stopping ...\n" - echo -n "SHUTDOWN\r\n" | nc localhost $REDISPORT & -+ echo -n "Stopping ..." ++ echo -n "Stopping Redis server ..." + echo -e "SHUTDOWN\r" | netcat localhost $REDISPORT & PID=$(cat $PIDFILE) while [ -x /proc/${PIDFILE} ] do -@@ -31,6 +47,22 @@ case "$1" in +- echo "Waiting for Redis to shutdown ..." + sleep 1 done rm $PIDFILE - echo "Redis stopped" -+ rc_status -v -+ fi -+ ;; +- echo "Redis stopped" + fi ++ rc_status -v + ;; + status) + if [ ! -f $PIDFILE ] + then -+ echo -n "$PIDFILE does not exist, process is not running" -+ rc_status -v ++ echo -n "Redis is not running" + else -+ echo -n "$PIDFILE does exist, process is running" -+ rc_status -v - fi - ;; ++ echo -n "Redis is running" ++ fi ++ rc_status -v ++ ;; + *) + echo "Usage: $0 [start|stop|status]" + ;; diff --git a/redis.spec b/redis.spec index b19d9a7..9c1d3dc 100644 --- a/redis.spec +++ b/redis.spec @@ -64,6 +64,17 @@ mkdir -p $RPM_BUILD_ROOT/var/lib/redis %clean rm -rf $RPM_BUILD_ROOT + +%post +%fillup_and_insserv %{name} +%restart_on_update %{name} + +%preun +%stop_on_removal %{name} + +%postun +%insserv_cleanup + %files %defattr(-,root,root) %doc 00-RELEASENOTES BETATESTING.txt BUGS COPYING Changelog README TODO