Author: glen                         Date: Mon Jul 20 12:44:42 2009 GMT
Module: packages                      Tag: HEAD
---- Log message:
- simplify and update initscript

---- Files affected:
packages/varnish:
   varnish.init (1.5 -> 1.6) , varnish.sysconfig (1.6 -> 1.7) 

---- Diffs:

================================================================
Index: packages/varnish/varnish.init
diff -u packages/varnish/varnish.init:1.5 packages/varnish/varnish.init:1.6
--- packages/varnish/varnish.init:1.5   Mon Jul 20 14:03:52 2009
+++ packages/varnish/varnish.init       Mon Jul 20 14:44:37 2009
@@ -9,10 +9,13 @@
 # pidfile: /var/run/varnish/varnishd.pid
 
 # Source function library.
-. /etc/init.d/functions
+. /etc/rc.d/init.d/functions
+
+# Get network config
+. /etc/sysconfig/network
 
 # Get service config - may override defaults
-[ -f /etc/sysconfig/varnishd ] && . /etc/sysconfig/varnishd
+[ -f /etc/sysconfig/varnish ] && . /etc/sysconfig/varnish
 
 # Check that networking is up.
 if is_yes "${NETWORKING}"; then
@@ -24,8 +27,22 @@
        exit 0
 fi
 
+# DAEMON_OPTS is used by the init script.  If you add or remove options, make
+# sure you update this section, too.
+DAEMON_OPTS="-a ${VARNISH_LISTEN_ADDRESS}:${VARNISH_LISTEN_PORT} \
+             -f ${VARNISH_VCL_CONF} \
+             -T ${VARNISH_ADMIN_LISTEN_ADDRESS}:${VARNISH_ADMIN_LISTEN_PORT} \
+             -t ${VARNISH_TTL} \
+                        -u ${VARNISH_USER} -g ${VARNISH_GROUP} \
+             -w 
${VARNISH_MIN_THREADS},${VARNISH_MAX_THREADS},${VARNISH_THREAD_TIMEOUT} \
+             -n ${VARNISH_NAME} \
+             -s ${VARNISH_STORAGE}"
+
+# default limits
+SERVICE_LIMITS="${SERVICE_LIMIS:--n $NFILES -l $MEMLOCK}"
+
 start() {
-       if [ -f /var/lock/subsys/varnishd ]; then
+       if [ -f /var/lock/subsys/varnish ]; then
                msg_already_running "Varnish HTTP accelerator"
                return
        fi
@@ -33,22 +50,22 @@
        msg_starting "Varnish HTTP accelerator"
        daemon /usr/sbin/varnishd $DAEMON_OPTS
        RETVAL=$?
-       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/varnishd
+       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/varnish
 }
 
 stop() {
-       if [ ! -f /var/lock/subsys/varnishd ]; then
+       if [ ! -f /var/lock/subsys/varnish ]; then
                msg_not_running "Varnish HTTP accelerator"
                return
        fi
 
        msg_stopping "Varnish HTTP accelerator"
-       killproc $DAEMON
-       rm -f /var/lock/subsys/varnishd
+       killproc /usr/sbin/varnishd
+       rm -f /var/lock/subsys/varnish
 }
 
 condrestart() {
-       if [ ! -f /var/lock/subsys/varnishd ]; then
+       if [ ! -f /var/lock/subsys/varnish ]; then
                msg_not_running "Varnish HTTP accelerator"
                RETVAL=$1
                return

================================================================
Index: packages/varnish/varnish.sysconfig
diff -u packages/varnish/varnish.sysconfig:1.6 
packages/varnish/varnish.sysconfig:1.7
--- packages/varnish/varnish.sysconfig:1.6      Mon Jul 20 14:14:00 2009
+++ packages/varnish/varnish.sysconfig  Mon Jul 20 14:44:37 2009
@@ -1,30 +1,30 @@
 # Configuration file for varnish
-#
-# /etc/rc.d/init.d/varnish expects the variable $DAEMON_OPTS to be set from 
this
-# shell script fragment.
-#
+# See varnishd(1) for more information.
 
 # Maximum number of open files (for ulimit -n)
 # Open files (usually 1024, which is way too small for varnish)
 NFILES=131072
 
-# Maxiumum locked memory size for shared memory log
+# Maximum locked memory size (for ulimit -l)
+# Used for locking the shared memory log in memory.  If you increase log size,
+# you need to increase this number as well
 MEMLOCK=82000
 
-SERVICE_LIMITS="-n $NFILES -l $MEMLOCK"
-
-# Advanced configuration
-#
-# See varnishd(1) for more information.
-#
 # Main configuration file. You probably want to change it :)
 VARNISH_VCL_CONF=/etc/varnish/default.vcl
 
+# Default varnish instance name is the local nodename.  Can be overridden with
+# the -n switch, to have more instances on a single server.
 INSTANCE=$(uname -n)
 
 # Name of this system / path to spool file
 VARNISH_NAME=/var/run/varnish/$INSTANCE
 
+# Specifies the name of an unprivileged user/group to which the child process 
should
+# switch before it starts accepting connections.
+VARNISH_USER=varnish
+VARNISH_GROUP=varnish
+
 # Default address and port to bind to
 # Blank address means all IPv4 and IPv6 interfaces, otherwise specify
 # a host name, an IPv4 dotted quad, or an IPv6 address in brackets.
@@ -56,13 +56,3 @@
 
 # Default TTL used when the backend does not specify one
 VARNISH_TTL=120
-
-# DAEMON_OPTS is used by the init script.  If you add or remove options, make
-# sure you update this section, too.
-DAEMON_OPTS="-a ${VARNISH_LISTEN_ADDRESS}:${VARNISH_LISTEN_PORT} \
-             -f ${VARNISH_VCL_CONF} \
-             -T ${VARNISH_ADMIN_LISTEN_ADDRESS}:${VARNISH_ADMIN_LISTEN_PORT} \
-             -t ${VARNISH_TTL} \
-             -w 
${VARNISH_MIN_THREADS},${VARNISH_MAX_THREADS},${VARNISH_THREAD_TIMEOUT} \
-             -n ${VARNISH_NAME} \
-             -s ${VARNISH_STORAGE}"
================================================================

---- CVS-web:
    
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/varnish/varnish.init?r1=1.5&r2=1.6&f=u
    
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/varnish/varnish.sysconfig?r1=1.6&r2=1.7&f=u

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

Reply via email to