Author: blues                        Date: Wed Dec  9 15:43:37 2009 GMT
Module: packages                      Tag: HEAD
---- Log message:
- make optional lighttpd-angel support (supervisor and HUP handler)

---- Files affected:
packages/lighttpd:
   lighttpd.init (1.14 -> 1.15) , lighttpd.spec (1.317 -> 1.318) , 
lighttpd.sysconfig (1.3 -> 1.4) 

---- Diffs:

================================================================
Index: packages/lighttpd/lighttpd.init
diff -u packages/lighttpd/lighttpd.init:1.14 
packages/lighttpd/lighttpd.init:1.15
--- packages/lighttpd/lighttpd.init:1.14        Sat Jul 25 22:05:01 2009
+++ packages/lighttpd/lighttpd.init     Wed Dec  9 16:43:31 2009
@@ -68,7 +68,13 @@
 
        checkconfig
        msg_starting "Lighttpd Web Server"; busy
-       env SHELL=/bin/sh lighttpd -f /etc/lighttpd/lighttpd.conf $HTTPD_OPTS
+       if is_yes "${LIGHT_ANGEL}"; then
+               daemon --fork --pidfile /var/run/lighttpd-angel.pid --makepid \
+                       env SHELL=/bin/sh lighttpd-angel -D -f 
/etc/lighttpd/lighttpd.conf $HTTPD_OPTS 1>&2
+
+       else
+               env SHELL=/bin/sh lighttpd -f /etc/lighttpd/lighttpd.conf 
$HTTPD_OPTS
+       fi
        RETVAL=$?
        if [ $RETVAL -eq 0 ]; then
                ok
@@ -88,15 +94,23 @@
        msg_stopping "Lighttpd Web Server"
        killproc --pidfile /var/run/lighttpd.pid lighttpd
        rm -f /var/lock/subsys/lighttpd >/dev/null 2>&1
+       rm -f /var/run/lighttpd*.pid >/dev/null 2>&1
 }
 
 restart() {
        local pid
 
        # short circuit to safe reload if pid exists and is alive
-       if [ -f /var/lock/subsys/lighttpd ] && pid=$(pidofproc lighttpd 
lighttpd.pid) && checkpid $pid; then
-               reload
-               return
+       if is_yes "${LIGHT_ANGEL}"; then
+               if [ -f /var/lock/subsys/lighttpd ] && pid=$(pidofproc 
lighttpd-angel lighttpd-angel.pid) && checkpid $pid; then
+                       reload
+                       return
+               fi
+       else
+               if [ -f /var/lock/subsys/lighttpd ] && pid=$(pidofproc lighttpd 
lighttpd.pid) && checkpid $pid; then
+                       reload
+                       return
+               fi
        fi
 
        checkconfig
@@ -105,6 +119,7 @@
 }
 
 reload() {
+       # TODO: check if process is running. Start it in this case.
        if [ ! -f /var/lock/subsys/lighttpd ]; then
                msg_not_running "Lighttpd Web Server"
                RETVAL=7
@@ -114,10 +129,17 @@
        checkconfig
        msg_reloading "Lighttpd Web Server"
 
-       # sending INT signal will make lighttpd close all listening sockets and
-       # wait for client connections to terminate.
-       killproc --pidfile /var/run/lighttpd.pid lighttpd -INT
-       env SHELL=/bin/sh lighttpd -f /etc/lighttpd/lighttpd.conf $HTTPD_OPTS
+       if is_yes "${LIGHT_ANGEL}"; then
+               # sending HUP signal to angel will make lighttpd close all 
listening
+               # sockets and wait for client connections to terminate. After 
that new
+               # child will be started
+               killproc lighttpd-angel -HUP
+       else
+               # sending INT signal will make lighttpd close all listening 
sockets and
+               # wait for client connections to terminate.
+               killproc --pidfile /var/run/lighttpd.pid lighttpd -INT
+               env SHELL=/bin/sh lighttpd -f /etc/lighttpd/lighttpd.conf 
$HTTPD_OPTS
+       fi
        RETVAL=$?
 }
 
@@ -141,6 +163,7 @@
        fi
 
        show "Rotating %s logs" lighttpd
+       # send HUP to main lighttpd (not angel) process to rotate logs:
        killproc --pidfile /var/run/lighttpd.pid lighttpd -HUP
        RETVAL=$?
 }
@@ -170,6 +193,7 @@
        checkconfig 1
        ;;
   status)
+       status lighttpd-angel
        status lighttpd
        RETVAL=$?
        ;;

================================================================
Index: packages/lighttpd/lighttpd.spec
diff -u packages/lighttpd/lighttpd.spec:1.317 
packages/lighttpd/lighttpd.spec:1.318
--- packages/lighttpd/lighttpd.spec:1.317       Tue Dec  1 17:06:03 2009
+++ packages/lighttpd/lighttpd.spec     Wed Dec  9 16:43:31 2009
@@ -24,7 +24,7 @@
 Summary(pl.UTF-8):     Szybki i lekki serwer HTTP
 Name:          lighttpd
 Version:       1.4.25
-Release:       2
+Release:       2.1
 License:       BSD
 Group:         Networking/Daemons/HTTP
 Source0:       
http://download.lighttpd.net/lighttpd/releases-1.4.x/%{name}-%{version}.tar.bz2
@@ -1305,6 +1305,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.318  2009/12/09 15:43:31  blues
+- make optional lighttpd-angel support (supervisor and HUP handler)
+
 Revision 1.317  2009/12/01 16:06:03  glen
 - fix build with older automake
 

================================================================
Index: packages/lighttpd/lighttpd.sysconfig
diff -u packages/lighttpd/lighttpd.sysconfig:1.3 
packages/lighttpd/lighttpd.sysconfig:1.4
--- packages/lighttpd/lighttpd.sysconfig:1.3    Tue Mar 29 22:39:21 2005
+++ packages/lighttpd/lighttpd.sysconfig        Wed Dec  9 16:43:31 2009
@@ -3,6 +3,11 @@
 # Define nice level for lighttpd
 #SERVICE_RUN_NICE_LEVEL="+0"
 
+# Use lighttpd-angel
+# Allows gracefull restart and crash recovery.
+# Off by default but consider enabling
+#LIGHT_ANGEL="yes"
+
 # Give it 4096 fd's.
 #SERVICE_LIMITS="$DEFAULT_SERVICE_LIMITS -n 4096"
 
================================================================

---- CVS-web:
    
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/lighttpd/lighttpd.init?r1=1.14&r2=1.15&f=u
    
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/lighttpd/lighttpd.spec?r1=1.317&r2=1.318&f=u
    
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/lighttpd/lighttpd.sysconfig?r1=1.3&r2=1.4&f=u

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to