Pavol Rusnak 2010-03-07 23:22:27 +00:00 committed by Git OBS Bridge
parent 4e1042c7e2
commit 4fe712f1b5
3 changed files with 35 additions and 12 deletions

View File

@ -11,3 +11,12 @@ Index: redis.conf
# 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.
@@ -64,7 +64,7 @@ dbfilename dump.rdb
# For default save/load DB in/from the working directory
# Note that you must specify a directory not a file name.
-dir ./
+dir /var/lib/redis/
################################# REPLICATION #################################

View File

@ -2,7 +2,7 @@ Index: utils/redis_init_script
===================================================================
--- utils/redis_init_script.orig
+++ utils/redis_init_script
@@ -1,28 +1,39 @@
@@ -1,28 +1,44 @@
#!/bin/sh
+### BEGIN INIT INFO
+# Provides: redis
@ -24,45 +24,57 @@ Index: utils/redis_init_script
-CONF="/etc/redis/${REDISPORT}.conf"
+PIDFILE=/var/run/redis.pid
+CONF=/etc/redis.conf
+
+. /etc/rc.status
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"
+ echo -n "$PIDFILE exists, process is already running or crashed"
+ rc_failed
else
- echo -n "Starting Redis server...\n"
+ echo "Starting Redis server..."
+ echo -n "Starting Redis server..."
$EXEC $CONF
+ rc_status -v
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"
+ echo -n "$PIDFILE does not exist, process is not running"
+ rc_failed
else
- echo -n "Stopping ...\n"
- echo -n "SHUTDOWN\r\n" | nc localhost $REDISPORT &
+ echo "Stopping ..."
+ echo -n "Stopping ..."
+ echo -e "SHUTDOWN\r" | netcat localhost $REDISPORT &
PID=$(cat $PIDFILE)
while [ -x /proc/${PIDFILE} ]
do
@@ -33,4 +44,15 @@ case "$1" in
@@ -31,6 +47,22 @@ case "$1" in
done
rm $PIDFILE
echo "Redis stopped"
fi
;;
+ rc_status -v
+ fi
+ ;;
+ status)
+ if [ ! -f $PIDFILE ]
+ then
+ echo "$PIDFILE does not exist, process is not running"
+ echo -n "$PIDFILE does not exist, process is not running"
+ rc_status -v
+ else
+ echo "$PIDFILE does exist, process is running"
+ fi
+ ;;
+ echo -n "$PIDFILE does exist, process is running"
+ rc_status -v
fi
;;
+ *)
+ echo "Usage: $0 [start|stop|status]"
+ ;;
esac
+
+rc_exit

View File

@ -59,6 +59,7 @@ 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
install -D -m 0644 redis.conf $RPM_BUILD_ROOT%{_sysconfdir}/redis.conf
mkdir -p $RPM_BUILD_ROOT/var/lib/redis
%clean
rm -rf $RPM_BUILD_ROOT
@ -72,6 +73,7 @@ rm -rf $RPM_BUILD_ROOT
%{_sysconfdir}/init.d/redis
%{_sbindir}/rcredis
%config(noreplace) %{_sysconfdir}/redis.conf
%dir /var/lib/redis
%files doc
%defattr(-,root,root)