Pavol Rusnak 2010-03-07 23:42:36 +00:00 committed by Git OBS Bridge
parent 4fe712f1b5
commit 9c398d1820
2 changed files with 28 additions and 14 deletions

View File

@ -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"
- echo "Redis stopped"
fi
+ rc_status -v
+ fi
+ ;;
;;
+ 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"
+ echo -n "Redis is running"
+ fi
+ rc_status -v
fi
;;
+ ;;
+ *)
+ echo "Usage: $0 [start|stop|status]"
+ ;;

View File

@ -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