[arch-commits] Commit in lighttpd/trunk (4 files)
Pierre Schmitz
pierre at archlinux.org
Sun Aug 29 16:52:50 UTC 2010
Date: Sunday, August 29, 2010 @ 12:52:49
Author: pierre
Revision: 89167
Upstream update
* rewrote rc script
* use lighttpd-angel for graceful reload and shutdown
* use reload in logrotate config
Modified:
lighttpd/trunk/PKGBUILD
lighttpd/trunk/lighttpd.conf
lighttpd/trunk/lighttpd.logrotate.d
lighttpd/trunk/lighttpd.rc.d
----------------------+
PKGBUILD | 14 +---
lighttpd.conf | 2
lighttpd.logrotate.d | 6 +-
lighttpd.rc.d | 141 +++++++++++++++++++++++++++++++------------------
4 files changed, 99 insertions(+), 64 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2010-08-29 16:45:20 UTC (rev 89166)
+++ PKGBUILD 2010-08-29 16:52:49 UTC (rev 89167)
@@ -2,7 +2,7 @@
# Maintainer: Pierre Schmitz <pierre at archlinux.de>
pkgname=lighttpd
-pkgver=1.4.27
+pkgver=1.4.28
pkgrel=1
pkgdesc='a secure, fast, compliant and very flexible web-server'
license=('custom')
@@ -18,10 +18,10 @@
options=('!libtool' 'emptydirs')
source=("http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-${pkgver}.tar.bz2"
'lighttpd.rc.d' 'lighttpd.logrotate.d' 'lighttpd.conf')
-md5sums=('afece7dc547d71cb94ea2e34ee5b3f9b'
- '789ed1b4521e72e591e09d5dfb99235a'
- '857e174643fd7761a2f0d8431a679f6c'
- 'da7b4ee2d2547d719015e54e8f2ff3d7')
+md5sums=('586eb535d31ac299652495b058dd87c4'
+ '638320101f1114a0a130d5532e7cd512'
+ '4b22edb80454cd815f076288aa117452'
+ '2803a9ee7f20409c69f1566d2d90720e')
build() {
cd $srcdir/$pkgname-$pkgver
@@ -56,9 +56,5 @@
find . -type f ! -name 'Makefile*' -exec install -D -m644 {} ${pkgdir}/usr/share/doc/lighttpd/config/{} \;
popd >/dev/null
- pushd doc >/dev/null
- find . -maxdepth 1 -type f -name '*.txt' -exec install -D -m644 {} ${pkgdir}/usr/share/doc/lighttpd/{} \;
- popd >/dev/null
-
install -D -m644 COPYING $pkgdir/usr/share/licenses/$pkgname/COPYING
}
Modified: lighttpd.conf
===================================================================
--- lighttpd.conf 2010-08-29 16:45:20 UTC (rev 89166)
+++ lighttpd.conf 2010-08-29 16:52:49 UTC (rev 89167)
@@ -6,7 +6,7 @@
server.username = "http"
server.groupname = "http"
server.document-root = "/srv/http"
-server.pid-file = "/var/run/lighttpd.pid"
+server.pid-file = "/var/run/lighttpd/lighttpd.pid"
server.errorlog = "/var/log/lighttpd/error.log"
dir-listing.activate = "enable"
index-file.names = ( "index.html" )
Modified: lighttpd.logrotate.d
===================================================================
--- lighttpd.logrotate.d 2010-08-29 16:45:20 UTC (rev 89166)
+++ lighttpd.logrotate.d 2010-08-29 16:52:49 UTC (rev 89167)
@@ -1,5 +1,5 @@
/var/log/lighttpd/*log {
- postrotate
- /bin/kill -HUP `cat /var/run/lighttpd/lighttpd.pid 2>/dev/null` 2> /dev/null || true
- endscript
+ postrotate
+ /etc/rc.d/lighttpd reload >/dev/null || true
+ endscript
}
Modified: lighttpd.rc.d
===================================================================
--- lighttpd.rc.d 2010-08-29 16:45:20 UTC (rev 89166)
+++ lighttpd.rc.d 2010-08-29 16:52:49 UTC (rev 89167)
@@ -1,67 +1,106 @@
#!/bin/bash
-daemon_name=lighttpd
-
. /etc/rc.conf
. /etc/rc.d/functions
+
+get_pid_file() {
+ /usr/sbin/lighttpd -p -f /etc/lighttpd/lighttpd.conf 2>/dev/null | grep server.pid-file | cut -d= -f2
+}
+
get_pid() {
- pidof -o %PPID $daemon_name
+ local pid_file=$(get_pid_file)
+ local pid=$(pidof -o %PPID lighttpd-angel)
+ if [ -r "${pid_file}" ]; then
+ cat "${pid_file}"
+ elif [ -n "${pid}" ]; then
+ echo "${pid}"
+ else
+ echo ''
+ fi
}
-case "$1" in
- start)
- stat_busy "Starting $daemon_name daemon"
+test_config() {
+ /usr/sbin/lighttpd -t -f /etc/lighttpd/lighttpd.conf >/dev/null 2>&1
+ if [ $? -gt 0 ]; then
+ stat_append ' (error in lighttpd.conf)'
+ stat_fail
+ exit 1
+ fi
+}
- PID=$(get_pid)
- if [ -z "$PID" ]; then
- [ -f /var/run/$daemon_name.pid ] && rm -f /var/run/$daemon_name.pid
- # RUN
- $daemon_name -f /etc/lighttpd/lighttpd.conf
- #
- if [ $? -gt 0 ]; then
- stat_fail
- exit 1
- else
- echo $(get_pid) > /var/run/$daemon_name.pid
- add_daemon $daemon_name
- stat_done
- fi
- else
- stat_fail
- exit 1
- fi
- ;;
+start() {
+ stat_busy 'Starting lighttpd'
+ test_config
- stop)
- stat_busy "Stopping $daemon_name daemon"
- PID=$(get_pid)
- # KILL
- [ ! -z "$PID" ] && kill $PID &> /dev/null
- #
- if [ $? -gt 0 ]; then
- stat_fail
- exit 1
- else
- rm -f /var/run/$daemon_name.pid &> /dev/null
- rm_daemon $daemon_name
- stat_done
- fi
- ;;
+ local PID=$(get_pid)
+ if [ -z "$PID" ]; then
+ nohup /usr/sbin/lighttpd-angel -D -f /etc/lighttpd/lighttpd.conf >/var/log/lighttpd/lighttpd-angel.log 2>&1 &
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ add_daemon lighttpd
+ stat_done
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+}
- restart)
- $0 stop
- sleep 3
- $0 start
- ;;
+stop() {
+ stat_busy 'Stopping lighttpd'
+ local PID=$(get_pid)
+ [ -n "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ local pid_file=$(get_pid_file)
+ [ -f "${pid_file}" ] && rm -f "${pid_file}"
+ rm_daemon lighttpd
+ stat_done
+ fi
+}
- status)
- stat_busy "Checking $daemon_name status";
- ck_status $daemon_name
- ;;
+reload() {
+ stat_busy 'Reloading lighttpd'
+ test_config
+ local PID=$(get_pid)
+ [ -n "$PID" ] && kill -HUP $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ stat_done
+ fi
+}
- *)
- echo "usage: $0 {start|stop|restart|status}"
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ reload)
+ reload
+ ;;
+ restart)
+ stat_busy 'Checking lighttpd.conf'
+ test_config
+ stat_done
+ stop
+ start
+ ;;
+ status)
+ stat_busy 'Checking lighttpd status';
+ ck_status lighttpd
+ ;;
+ *)
+ echo "usage: $0 {start|stop|reload|restart|status}"
esac
exit 0
More information about the arch-commits
mailing list