1 %define mod_name whatkilledus
2 %define apxs /usr/sbin/apxs
3 Summary: Apache module: logs request when child process crashes
4 Name: apache-mod_%{mod_name}
8 Group: Networking/Daemons
9 Source0: http://people.apache.org/~trawick/mod_whatkilledus.c
10 # Source0-md5: e59c5d56e294a31e5b158ad5e4553001
11 Source1: http://mirrors.ludost.net/gentoo-portage/www-apache/mod_whatkilledus/files/gen_test_char.c
12 # Source1-md5: 7c4e734d1afc695a5be53581998f3700
13 BuildRequires: %{apxs}
14 BuildRequires: apache-devel >= 2.0
15 BuildRequires: rpmbuild(macros) >= 1.268
16 Requires: apache(modules-api) = %apache_modules_api
17 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
19 %define _pkglibdir %(%{apxs} -q LIBEXECDIR 2>/dev/null)
20 %define _sysconfdir %(%{apxs} -q SYSCONFDIR 2>/dev/null)
21 %define _pkglogdir %(%{apxs} -q PREFIX 2>/dev/null)/logs
24 mod_whatkilledus is an experimental module for Apache httpd 2.x which
25 tracks the current request and logs a report of the active request
26 when a child process crashes. You should verify that it works
27 reasonably on your system before putting it in production.
34 %{__cc} `%{_bindir}/apr-1-config --includes --cppflags` %{SOURCE1} -o gen_test_char
35 ./gen_test_char > test_char.h
36 %{apxs} -c mod_%{mod_name}.c -o mod_%{mod_name}.la
39 rm -rf $RPM_BUILD_ROOT
40 install -d $RPM_BUILD_ROOT{%{_pkglibdir},%{_sysconfdir}/httpd.conf,/var/log/httpd}
41 install .libs/mod_%{mod_name}.so $RPM_BUILD_ROOT%{_pkglibdir}
43 touch $RPM_BUILD_ROOT/var/log/httpd/whatkilledus_log
45 cat > $RPM_BUILD_ROOT%{_sysconfdir}/httpd.conf/90_mod_%{mod_name}.conf << 'EOF'
46 LoadModule %{mod_name}_module modules/mod_%{mod_name}.so
47 EnableExceptionHook On
48 WhatKilledUsLog /var/log/httpd/whatkilledus_log
52 rm -rf $RPM_BUILD_ROOT
55 %service -q httpd restart
56 touch /var/log/httpd/whatkilledus_log && chown root:http /var/log/httpd/whatkilledus_log && chmod 620 /var/log/httpd/whatkilledus_log
59 if [ "$1" = "0" ]; then
60 %service -q httpd restart
64 %defattr(644,root,root,755)
65 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/httpd.conf/*_mod_%{mod_name}.conf
66 %attr(755,root,root) %{_pkglibdir}/*.so
68 %attr(620,root,http) %ghost /var/log/httpd/whatkilledus_log