diff --git a/redis-conf.patch b/redis-conf.patch index e175467..1c655b0 100644 --- a/redis-conf.patch +++ b/redis-conf.patch @@ -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 ################################# + diff --git a/redis-initscript.patch b/redis-initscript.patch index c7e8508..f740322 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,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 diff --git a/redis.spec b/redis.spec index 2e3140e..b19d9a7 100644 --- a/redis.spec +++ b/redis.spec @@ -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)