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.orig
+++ utils/redis_init_script +++ utils/redis_init_script
@@ -1,28 +1,44 @@ @@ -1,36 +1,67 @@
#!/bin/sh #!/bin/sh
+### BEGIN INIT INFO +### BEGIN INIT INFO
+# Provides: redis +# Provides: redis
@ -26,6 +26,8 @@ Index: utils/redis_init_script
+CONF=/etc/redis.conf +CONF=/etc/redis.conf
+ +
+. /etc/rc.status +. /etc/rc.status
+
+rc_reset
case "$1" in case "$1" in
start) start)
@ -36,8 +38,9 @@ Index: utils/redis_init_script
+ rc_failed + rc_failed
else else
- echo -n "Starting Redis server...\n" - echo -n "Starting Redis server...\n"
- $EXEC $CONF
+ echo -n "Starting Redis server..." + echo -n "Starting Redis server..."
$EXEC $CONF + $EXEC $CONF > /dev/null
+ rc_status -v + rc_status -v
fi fi
;; ;;
@ -50,28 +53,28 @@ Index: utils/redis_init_script
else else
- echo -n "Stopping ...\n" - echo -n "Stopping ...\n"
- echo -n "SHUTDOWN\r\n" | nc localhost $REDISPORT & - echo -n "SHUTDOWN\r\n" | nc localhost $REDISPORT &
+ echo -n "Stopping ..." + echo -n "Stopping Redis server ..."
+ echo -e "SHUTDOWN\r" | netcat localhost $REDISPORT & + echo -e "SHUTDOWN\r" | netcat localhost $REDISPORT &
PID=$(cat $PIDFILE) PID=$(cat $PIDFILE)
while [ -x /proc/${PIDFILE} ] while [ -x /proc/${PIDFILE} ]
do do
@@ -31,6 +47,22 @@ case "$1" in - echo "Waiting for Redis to shutdown ..."
sleep 1
done done
rm $PIDFILE rm $PIDFILE
echo "Redis stopped" - echo "Redis stopped"
+ rc_status -v fi
+ fi + rc_status -v
+ ;; ;;
+ status) + status)
+ if [ ! -f $PIDFILE ] + if [ ! -f $PIDFILE ]
+ then + then
+ echo -n "$PIDFILE does not exist, process is not running" + echo -n "Redis is not running"
+ rc_status -v
+ else + else
+ echo -n "$PIDFILE does exist, process is running" + echo -n "Redis is running"
+ rc_status -v + fi
fi + rc_status -v
;; + ;;
+ *) + *)
+ echo "Usage: $0 [start|stop|status]" + echo "Usage: $0 [start|stop|status]"
+ ;; + ;;

View File

@ -64,6 +64,17 @@ mkdir -p $RPM_BUILD_ROOT/var/lib/redis
%clean %clean
rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT
%post
%fillup_and_insserv %{name}
%restart_on_update %{name}
%preun
%stop_on_removal %{name}
%postun
%insserv_cleanup
%files %files
%defattr(-,root,root) %defattr(-,root,root)
%doc 00-RELEASENOTES BETATESTING.txt BUGS COPYING Changelog README TODO %doc 00-RELEASENOTES BETATESTING.txt BUGS COPYING Changelog README TODO