- Added logging to /var/log/redis/redis.log.

- Added log rotation.

OBS-URL: https://build.opensuse.org/package/show/server:database/redis?expand=0&rev=16
This commit is contained in:
Andreas Schneider 2011-01-18 21:10:38 +00:00 committed by Git OBS Bridge
parent 1bb7c7e532
commit aa12e8e31f
5 changed files with 72 additions and 21 deletions

View File

@ -20,7 +20,7 @@ Index: redis.conf
# Close the connection after a client is idle for N seconds (0 to disable)
timeout 300
@@ -24,7 +24,7 @@ timeout 300
@@ -24,12 +24,12 @@ timeout 300
# debug (a lot of information, useful for development/testing)
# notice (moderately verbose, what you want in production probably)
# warning (only very important / critical messages are logged)
@ -29,6 +29,12 @@ Index: redis.conf
# Specify the log file name. Also 'stdout' can be used to force
# the demon to log on the standard output. Note that if you use standard
# output for logging but daemonize, logs will be sent to /dev/null
-logfile stdout
+logfile /var/log/redis/redis.log
# Set the number of databases. The default database is DB 0, you can select
# a different one on a per-connection basis using SELECT <dbid> where
@@ -64,7 +64,7 @@ dbfilename dump.rdb
# For default save/load DB in/from the working directory

View File

@ -2,7 +2,7 @@ Index: utils/redis_init_script
===================================================================
--- utils/redis_init_script.orig
+++ utils/redis_init_script
@@ -1,36 +1,69 @@
@@ -1,36 +1,75 @@
#!/bin/sh
+#
+# /etc/init.d/redis
@ -27,6 +27,7 @@ Index: utils/redis_init_script
-PIDFILE=/var/run/redis_${REDISPORT}.pid
-CONF="/etc/redis/${REDISPORT}.conf"
+LOGFILE=/var/log/redis.log
+PIDFILE=/var/run/redis.pid
+CONF=/etc/redis.conf
@ -38,6 +39,11 @@ Index: utils/redis_init_script
- else
- echo -n "Starting Redis server...\n"
- $EXEC $CONF
+ # Create a logfile the server can write into.
+ if [ ! -r $LOGFILE ]; then
+ touch $LOGFILE
+ chown redis:redis $LOGFILE
+ fi
+ # Create a pidfile the server can write into.
+ if [ ! -r $PIDFILE ]; then
+ touch $PIDFILE

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Jan 18 21:08:35 UTC 2011 - asn@cryptomilk.org
- Added logging to /var/log/redis/redis.log.
- Added log rotation.
-------------------------------------------------------------------
Mon Jan 10 16:29:31 CET 2011 - asn@cryptomilk.org

9
redis.logrotate Normal file
View File

@ -0,0 +1,9 @@
/var/log/redis/*.log {
weekly
rotate 10
copytruncate
delaycompress
compress
notifempty
missingok
}

View File

@ -14,21 +14,28 @@
# norootforbuild
%define _home_dir %{_var}/run/%{name}
%define _data_dir %{_var}/lib/%{name}
Name: redis
Version: 1.2.6
Release: 1
Url: http://code.google.com/p/redis/
#
License: BSD License
Group: Productivity/Databases/Servers
Summary: Persistent key-value database with built-in net interface
Summary: Persistent key-value database
Url: http://code.google.com/p/redis/
#
Source: http://redis.googlecode.com/files/%{name}-%{version}.tar.bz2
Source1: %{name}.logrotate
#
Patch0: %{name}-initscript.patch
Patch1: %{name}-conf.patch
#
BuildRoot: %{_tmppath}/%{name}-%{version}-build
# for init script
Requires: netcat
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%define pkg_homedir %{_var}/run/%{name}
%define pkg_datadir %{_var}/lib/%{name}
Requires: logrotate
%description
Redis is an advanced key-value store. It is similar to memcached but the dataset
@ -39,12 +46,12 @@ side union, intersection, difference between sets, and so forth. Redis supports
different kind of sorting abilities.
%package doc
Summary: HTML documentation for Redis
Summary: HTML documentation for redis
Group: Productivity/Databases/Servers
Requires: redis = %{version}
%description doc
HTML documentation for Redis
HTML documentation for redis database.
%prep
%setup -q
@ -56,20 +63,37 @@ mv doc html
make PROF="%{optflags}" %{?jobs:-j%jobs}
%install
install -D -m 0755 redis-benchmark $RPM_BUILD_ROOT%{_bindir}/redis-benchmark
install -D -m 0755 redis-cli $RPM_BUILD_ROOT%{_bindir}/redis-cli
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
install -d $RPM_BUILD_ROOT%{pkg_homedir} $RPM_BUILD_ROOT%{pkg_datadir}
%{__install} -Dd -m 0755 \
%{buildroot}%{_sysconfdir}/init.d \
%{buildroot}%{_sysconfdir}/logrotate.d \
%{buildroot}%{_bindir} \
%{buildroot}%{_libdir} \
%{buildroot}%{_sbindir} \
%{buildroot}%{_data_dir}
%{__install} -m 0755 redis-benchmark %{buildroot}%{_bindir}/redis-benchmark
%{__install} -m 0755 redis-cli %{buildroot}%{_bindir}/redis-cli
%{__install} -m 0755 redis-server %{buildroot}%{_sbindir}/redis-server
%{__install} -m 0644 redis.conf %{buildroot}%{_sysconfdir}/redis.conf
#
# init
#
%{__install} -m 0755 utils/redis_init_script %{buildroot}%{_sysconfdir}/init.d/redis
%{__ln_s} %{_sysconfdir}/init.d/%{name} %{buildroot}%{_sbindir}/rc%{name}
#
# logrotate
#
%{__install} -m 0644 %{S:1} \
%{buildroot}%{_sysconfdir}/logrotate.d/%{name}
%clean
rm -rf $RPM_BUILD_ROOT
rm -rf %{buildroot}
%pre
/usr/sbin/groupadd -r %{name} &>/dev/null || :
/usr/sbin/useradd -o -g %{name} -s /bin/false -r -c "User for Redis key-value store" -d %{pkg_homedir} %{name} &>/dev/null || :
/usr/sbin/useradd -o -g %{name} -s /bin/false -r -c "User for Redis key-value store" -d %{_home_dir} %{name} &>/dev/null || :
%post
%fillup_and_insserv %{name}
@ -84,14 +108,14 @@ rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%doc 00-RELEASENOTES BETATESTING.txt BUGS COPYING Changelog README TODO
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%{_bindir}/redis-benchmark
%{_bindir}/redis-cli
%{_sbindir}/redis-server
%{_sbindir}/rcredis
%{_sbindir}/rc%{name}
%config(noreplace) %{_sysconfdir}/init.d/redis
%config(noreplace) %attr(0640, %{name}, %{name}) %{_sysconfdir}/redis.conf
%dir %attr(0750, %{name}, %{name}) %{pkg_homedir}
%dir %attr(0750, %{name}, %{name}) %{pkg_datadir}
%dir %attr(0750, %{name}, %{name}) %{_data_dir}
%files doc
%defattr(-,root,root)