From d71dcf82902127fa4e989c39c85d4cf557fc48b9 Mon Sep 17 00:00:00 2001 From: ingvar Date: Wed, 27 Aug 2008 07:13:26 +0000 Subject: [PATCH] Fixed up init script for varnishlog git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3136 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/redhat/varnish.spec | 5 +- varnish-cache/redhat/varnishlog.initrc | 151 ++++++++++++++++--------- 2 files changed, 99 insertions(+), 57 deletions(-) diff --git a/varnish-cache/redhat/varnish.spec b/varnish-cache/redhat/varnish.spec index b26bc83f..eace9c28 100644 --- a/varnish-cache/redhat/varnish.spec +++ b/varnish-cache/redhat/varnish.spec @@ -1,7 +1,7 @@ Summary: Varnish is a high-performance HTTP accelerator Name: varnish Version: 2.0 -Release: 0.3.20080826svn3132%{?dist} +Release: 0.4.20080827svn3135%{?dist} License: BSD Group: System Environment/Daemons URL: http://www.varnish-cache.org/ @@ -197,6 +197,9 @@ fi %postun libs -p /sbin/ldconfig %changelog +* Wed Aug 27 2008 Ingvar Hagelund - 2.0-0.4.20080827svn3136 +- Fixed up init script for varnishlog too + * Mon Aug 25 2008 Ingvar Hagelund - 2.0-0.3.20080825svn3125 - Fixing up init script according to newer Fedora standards - The build now runs the test suite after compiling diff --git a/varnish-cache/redhat/varnishlog.initrc b/varnish-cache/redhat/varnishlog.initrc index d8119582..329651f0 100644 --- a/varnish-cache/redhat/varnishlog.initrc +++ b/varnish-cache/redhat/varnishlog.initrc @@ -1,77 +1,116 @@ #! /bin/sh # -# varnishlog Control the varnish HTTP accelerator logging daemon +# varnishlog Control the varnish logging daemon # # chkconfig: - 90 10 -# description: HTTP accelerator logging daemon +# description: Varnish logging daemon # processname: varnishlog # config: # pidfile: /var/run/varnish/varnishlog.pid +### BEGIN INIT INFO +# Provides: varnishlog +# Required-Start: $network $local_fs $remote_fs +# Required-Stop: $network $local_fs $remote_fs +# Short-Description: start and stop varnishlog +# Description: Varnish HTTP accelerator logging daemon +### END INIT INFO + # Source function library. . /etc/init.d/functions -RETVAL=0 -PROCNAME=varnishlog +retval=0 +pidfile="/var/run/varnishlog.pid" +lockfile="/var/lock/subsys/varnishlog" +logfile="/var/log/varnish/varnish.log" -DAEMON="/usr/bin/varnishlog" -PIDFILE="/var/run/varnish/varnishlog.pid" -LOCKFILE="/var/lock/subsys/varnishlog" -LOGFILE="/var/log/varnish/varnish.log" +exec="/usr/bin/varnishlog" +prog="varnishlog" -DAEMON_OPTS="-a -w ${LOGFILE} -D -P $PIDFILE" +DAEMON_OPTS="-a -w $logfile -D -P $pidfile" -mkdir -p /var/run/varnish 2>/dev/null +# Include varnish defaults +[ -e /etc/sysconfig/varnishlog ] && . /etc/sysconfig/varnishlog -# See how we were called. -case "$1" in - start) - echo -n "Starting varnish logging daeon: " - daemon --pidfile $PIDFILE $DAEMON "$DAEMON_OPTS" - sleep 1 - pkill -0 $PROCNAME - RETVAL=$? - if [ $RETVAL -eq 0 ] +lockfile=/var/lock/subsys/$prog + +start() { + + if [ ! -x $exec ] then - echo_success - touch $LOCKFILE - else - echo_failure + echo $exec not found + exit 5 fi + + echo -n "Starting varnish logging daemon: " + + daemon --pidfile $pidfile $exec "$DAEMON_OPTS" echo - ;; - stop) - echo -n "Stopping varnish logging daemon: " - killproc -p $PIDFILE $DAEMON - RETVAL=$? - if [ $RETVAL -eq 0 ] - then - echo_success - rm -f $LOCKFILE $PIDFILE - else - echo_failure - fi + return $retval +} + +stop() { + echo -n "Stopping varnish daemon: " + killproc $prog + retval=$? echo - ;; - status) - status -p $PIDFILE $PROCNAME - RETVAL=$? - ;; - restart|reload) - $0 stop - $0 start - RETVAL=$? - ;; - condrestart) - if [ -f $PIDFILE ]; then - $0 stop - $0 start - RETVAL=$? - fi - ;; - *) - echo "Usage: $0 {start|stop|status|restart|condrestart}" - exit 1 + [ $retval -eq 0 ] && rm -f $lockfile + return $retval +} + +restart() { + stop + start +} + +reload() { + restart +} + +force_reload() { + restart +} + +rh_status() { + status -p $pidfile $prog +} + +rh_status_q() { + rh_status >/dev/null 2>&1 +} + +# See how we were called. +case "$1" in + start) + rh_status_q && exit 0 + $1 + ;; + stop) + rh_status_q || exit 0 + $1 + ;; + restart) + $1 + ;; + reload) + rh_status_q || exit 7 + $1 + ;; + force-reload) + force_reload + ;; + status) + rh_status + ;; + condrestart|try-restart) + rh_status_q || exit 0 + restart + ;; + *) + echo "Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" + + exit 2 esac -exit $RETVAL +exit $? + -- 2.39.5