r1402 - branches/1.0/redhat

ingvar at projects.linpro.no ingvar at projects.linpro.no
Thu May 10 21:24:34 CEST 2007


Author: ingvar
Date: 2007-05-10 21:24:34 +0200 (Thu, 10 May 2007)
New Revision: 1402

Added:
   branches/1.0/redhat/varnish.logrotate
   branches/1.0/redhat/varnishlog.initrc
Modified:
   branches/1.0/redhat/varnish.initrc
   branches/1.0/redhat/varnish.spec
   branches/1.0/redhat/varnish.sysconfig
Log:
- Updates after fedora review request
- Added logrotate and init scripts for varnishlog



Modified: branches/1.0/redhat/varnish.initrc
===================================================================
--- branches/1.0/redhat/varnish.initrc	2007-05-10 11:58:14 UTC (rev 1401)
+++ branches/1.0/redhat/varnish.initrc	2007-05-10 19:24:34 UTC (rev 1402)
@@ -5,7 +5,7 @@
 # chkconfig: - 90 10
 # description: HTTP accelerator
 # processname: varnishd
-# config: /etc/varnish.conf
+# config: /etc/varnish/vcl.conf
 # pidfile: /var/run/varnish/varnishd.pid
 
 # Source function library.
@@ -24,9 +24,12 @@
 		-w ${VARNISH_MIN_WORKER_THREADS},${VARNISH_MAX_WORKER_THREADS},${VARNISH_WORKER_THREAD_TIMEOUT} \
 		-s ${VARNISH_BACKEND_STORAGE}"	
 
-
 mkdir -p /var/run/varnish 2>/dev/null
 
+# Open files (usually 1024, which is way too small for varnish)
+[ ! "${NFILES}" ] && NFILES="131072"
+ulimit -n ${NFILES}
+
 # See how we were called.
 case "$1" in
   start)
@@ -66,8 +69,15 @@
 	$0 start
 	RETVAL=$?
 	;;
+  condrestart)
+        if [ -f /var/lock/subsys/varnish ]; then
+            $0 stop
+            $0 start
+            RETVAL=$?
+        fi
+	;;
   *)
-	echo "Usage: $0 {start|stop|status|restart}"
+	echo "Usage: $0 {start|stop|status|restart|condrestart}"
 	exit 1
 esac
 

Added: branches/1.0/redhat/varnish.logrotate
===================================================================
--- branches/1.0/redhat/varnish.logrotate	2007-05-10 11:58:14 UTC (rev 1401)
+++ branches/1.0/redhat/varnish.logrotate	2007-05-10 19:24:34 UTC (rev 1402)
@@ -0,0 +1,8 @@
+/var/log/varnish/varnish.log {
+    missingok
+    notifempty
+    sharedscripts
+    postrotate
+        /bin/kill -HUP `cat /var/run/varnish/varnishlog.pid 2>/dev/null` 2> /dev/null || true
+    endscript
+}

Modified: branches/1.0/redhat/varnish.spec
===================================================================
--- branches/1.0/redhat/varnish.spec	2007-05-10 11:58:14 UTC (rev 1401)
+++ branches/1.0/redhat/varnish.spec	2007-05-10 19:24:34 UTC (rev 1402)
@@ -8,7 +8,7 @@
 Group: System Environment/Daemons
 URL: http://www.varnish-cache.org/
 #Packager: Ingvar Hagelund <ingvar at linpro.no>
-Source0: %{name}-%{version}.tar.gz
+Source0: http://kent.dl.sourceforge.net/sourceforge/varnish/%{name}-%{version}.tar.gz
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
 BuildRequires: gcc gcc-c++ ncurses-devel libtool autoconf automake
 Requires: gcc ncurses kernel >= 2.6.0 %{lib_name} = %version-%{release}

Modified: branches/1.0/redhat/varnish.sysconfig
===================================================================
--- branches/1.0/redhat/varnish.sysconfig	2007-05-10 11:58:14 UTC (rev 1401)
+++ branches/1.0/redhat/varnish.sysconfig	2007-05-10 19:24:34 UTC (rev 1402)
@@ -49,3 +49,6 @@
 # Set default ttl in secounds
 VARNISH_TTL=120
 
+# The Maximum number of open files (ulimit)
+# Default : 131072 (system default is usually 1024)
+NFILES=131072

Added: branches/1.0/redhat/varnishlog.initrc
===================================================================
--- branches/1.0/redhat/varnishlog.initrc	2007-05-10 11:58:14 UTC (rev 1401)
+++ branches/1.0/redhat/varnishlog.initrc	2007-05-10 19:24:34 UTC (rev 1402)
@@ -0,0 +1,90 @@
+#! /bin/sh
+#
+# varnishlog	Control the varnish HTTP accelerator logging daemon
+#
+# chkconfig: - 90 10
+# description: HTTP accelerator logging daemon
+# processname: varnishlog
+# config: 
+# pidfile: /var/run/varnish/varnishlog.pid
+
+# Source function library.
+. /etc/init.d/functions
+
+RETVAL=0
+PROCNAME=varnishlog
+
+. /etc/sysconfig/varnish
+
+if [ "$LOGDAEMON" = "" ]
+then
+    DAEMON="/usr/bin/varnishlog"
+else
+    DAEMON="$LOGDAEMON"
+fi
+
+if [ "$LOGPIDFILE" = "" ]
+then
+    PIDFILE="/var/run/varnish/varnishlog.pid"
+else
+    PIDFILE="$LOGPIDFILE"
+fi
+
+if [ "$LOGFILE" = "" ]; then LOGFILE="/var/log/varnish/varnish.log"; fi
+
+DAEMON_OPTS="-a -w ${LOGFILE} -D -p $PIDFILE"
+
+mkdir -p /var/run/varnish 2>/dev/null
+
+# See how we were called.
+case "$1" in
+  start)
+	echo -n "Starting varnish logging daeon: "
+	daemon $DAEMON "$DAEMON_OPTS"
+	sleep 1
+	pkill -0 $PROCNAME
+	RETVAL=$?
+	if [ $RETVAL -eq 0 ]
+	then
+		echo_success
+		touch /var/lock/subsys/varnishlog
+	else
+		echo_failure
+	fi
+	echo
+	;;
+  stop)
+	echo -n "Stopping varnish logging daemon: "
+	killproc $DAEMON
+	RETVAL=$?
+	if [ $RETVAL -eq 0 ]
+	then
+		echo_success
+		rm -f /var/lock/subsys/varnishlog
+	else
+		echo_failure
+	fi
+	echo
+	;;
+  status)
+	status $PROCNAME
+	RETVAL=$?
+	;;
+  restart|reload)
+  	$0 stop
+	$0 start
+	RETVAL=$?
+	;;
+  condrestart)
+        if [ -f /var/lock/subsys/varnishlog ]; then
+            $0 stop
+            $0 start
+            RETVAL=$?
+        fi
+	;;
+  *)
+	echo "Usage: $0 {start|stop|status|restart|condrestart}"
+	exit 1
+esac
+
+exit $RETVAL




More information about the varnish-commit mailing list