From 5e9ddf38f85f18bb4cf62baf88a61af88fd8489b Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Thu, 3 Sep 2009 17:30:54 +0000 Subject: main/mini_httpd: added logrotate script moved default logfile and pid fiels to /var/{run,log}/mini_httpd/ fixes #80 --- main/mini_httpd/APKBUILD | 13 +++++++++---- main/mini_httpd/mini_httpd.conf.sample | 4 +++- main/mini_httpd/mini_httpd.initd | 4 ++-- main/mini_httpd/mini_httpd.logrotate | 16 ++++++++++++++++ 4 files changed, 30 insertions(+), 7 deletions(-) create mode 100644 main/mini_httpd/mini_httpd.logrotate (limited to 'main') diff --git a/main/mini_httpd/APKBUILD b/main/mini_httpd/APKBUILD index 4f7167e70..6bce99530 100644 --- a/main/mini_httpd/APKBUILD +++ b/main/mini_httpd/APKBUILD @@ -1,16 +1,17 @@ # Maintainer: Natanael Copa pkgname=mini_httpd pkgver=1.19 -pkgrel=1 +pkgrel=2 pkgdesc="Small forking webserver with ssl and ipv6 support" url="http://www.acme.com/software/mini_httpd/" license="BSD" -depends= +depends="logrotate" makedepends="openssl-dev" subpackages="$pkgname-doc" source="http://www.acme.com/software/mini_httpd/$pkgname-$pkgver.tar.gz $pkgname.conf.sample $pkgname.initd + $pkgname.logrotate " build() { @@ -35,8 +36,12 @@ build() { install -D -m644 ../mini_httpd.conf.sample \ "$pkgdir"/etc/mini_httpd.conf install -D -m755 ../mini_httpd.initd "$pkgdir"/etc/init.d/mini_httpd + install -D -m644 ../mini_httpd.logrotate \ + "$pkgdir"/etc/logrotate.d/mini_httpd + install -d "$pkgdir"/var/run/mini_httpd "$pkgdir"/var/log/mini_httpd } md5sums="7c68293ad265ecfe2edea917912f6f1f mini_httpd-1.19.tar.gz -ec656aadd4751a3f4f6e8c788a5237f2 mini_httpd.conf.sample -804e5cba1537bddac195e64b5b50d609 mini_httpd.initd" +bca5b3b1cdc00cf31f0b54797518b893 mini_httpd.conf.sample +7cfcf81d75be204ecb60eb18fa4d96a7 mini_httpd.initd +915683e9c7e1cef7ce9b1bbaa31ab680 mini_httpd.logrotate" diff --git a/main/mini_httpd/mini_httpd.conf.sample b/main/mini_httpd/mini_httpd.conf.sample index 397a331ad..002f4f0c7 100644 --- a/main/mini_httpd/mini_httpd.conf.sample +++ b/main/mini_httpd/mini_httpd.conf.sample @@ -27,7 +27,9 @@ dir=/var/www/localhost/htdocs chroot #nochroot ## -logfile=/var/log/mini_httpd.log +## The init.d script will override logfile here, so you need to set the +## MINI_HTTPD_OPTS in /etc/conf.d/ in order to enable the logfile option here +#logfile=/var/log/mini_httpd/mini_httpd.log ## #charset=iso-8859-1 ## diff --git a/main/mini_httpd/mini_httpd.initd b/main/mini_httpd/mini_httpd.initd index 4460a539e..b55340ac5 100644 --- a/main/mini_httpd/mini_httpd.initd +++ b/main/mini_httpd/mini_httpd.initd @@ -3,7 +3,7 @@ # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/www-servers/mini_httpd/files/mini_httpd.init,v 1.2 2007/08/26 21:20:21 bangert Exp $ -pidfile=/var/run/${SVCNAME}.pid +pidfile=/var/run/mini_httpd/${SVCNAME}.pid depend() { need net @@ -13,7 +13,7 @@ start() { ebegin "Starting $SVCNAME" start-stop-daemon --quiet --start --exec /usr/sbin/mini_httpd \ --pidfile $pidfile -- -i $pidfile \ - ${MINI_HTTPD_OPTS:--C /etc/${SVCNAME}.conf} + ${MINI_HTTPD_OPTS:--C /etc/${SVCNAME}.conf -l /var/log/mini_httpd/${SVCNAME}.log} eend $? } diff --git a/main/mini_httpd/mini_httpd.logrotate b/main/mini_httpd/mini_httpd.logrotate new file mode 100644 index 000000000..bbd448b80 --- /dev/null +++ b/main/mini_httpd/mini_httpd.logrotate @@ -0,0 +1,16 @@ +/var/log/mini_httpd/*.log { + weekly + missingok + copytruncate + rotate 7 + compress + notifempty + sharedscripts + postrotate + for i in /var/run/mini_httpd*.pid /var/run/mini_httpd/*.pid; do \ + if [ -f "$i" ]; then \ + /etc/init.d/$(basename $i .pid) restart > /dev/null 2>&1 || true ; \ + fi; \ + done; + endscript +} -- cgit v1.2.3