Commit a18ce45a authored by Ingvar Hagelund's avatar Ingvar Hagelund

Fixed up init script for varnishlog

git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@3136 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent a4cc514d
Summary: Varnish is a high-performance HTTP accelerator Summary: Varnish is a high-performance HTTP accelerator
Name: varnish Name: varnish
Version: 2.0 Version: 2.0
Release: 0.3.20080826svn3132%{?dist} Release: 0.4.20080827svn3135%{?dist}
License: BSD License: BSD
Group: System Environment/Daemons Group: System Environment/Daemons
URL: http://www.varnish-cache.org/ URL: http://www.varnish-cache.org/
...@@ -197,6 +197,9 @@ fi ...@@ -197,6 +197,9 @@ fi
%postun libs -p /sbin/ldconfig %postun libs -p /sbin/ldconfig
%changelog %changelog
* Wed Aug 27 2008 Ingvar Hagelund <ingvar@linpro.no> - 2.0-0.4.20080827svn3136
- Fixed up init script for varnishlog too
* Mon Aug 25 2008 Ingvar Hagelund <ingvar@linpro.no> - 2.0-0.3.20080825svn3125 * Mon Aug 25 2008 Ingvar Hagelund <ingvar@linpro.no> - 2.0-0.3.20080825svn3125
- Fixing up init script according to newer Fedora standards - Fixing up init script according to newer Fedora standards
- The build now runs the test suite after compiling - The build now runs the test suite after compiling
......
#! /bin/sh #! /bin/sh
# #
# varnishlog Control the varnish HTTP accelerator logging daemon # varnishlog Control the varnish logging daemon
# #
# chkconfig: - 90 10 # chkconfig: - 90 10
# description: HTTP accelerator logging daemon # description: Varnish logging daemon
# processname: varnishlog # processname: varnishlog
# config: # config:
# pidfile: /var/run/varnish/varnishlog.pid # 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. # Source function library.
. /etc/init.d/functions . /etc/init.d/functions
RETVAL=0 retval=0
PROCNAME=varnishlog pidfile="/var/run/varnishlog.pid"
lockfile="/var/lock/subsys/varnishlog"
logfile="/var/log/varnish/varnish.log"
DAEMON="/usr/bin/varnishlog" exec="/usr/bin/varnishlog"
PIDFILE="/var/run/varnish/varnishlog.pid" prog="varnishlog"
LOCKFILE="/var/lock/subsys/varnishlog"
LOGFILE="/var/log/varnish/varnish.log"
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. lockfile=/var/lock/subsys/$prog
case "$1" in
start) start() {
echo -n "Starting varnish logging daeon: "
daemon --pidfile $PIDFILE $DAEMON "$DAEMON_OPTS" if [ ! -x $exec ]
sleep 1
pkill -0 $PROCNAME
RETVAL=$?
if [ $RETVAL -eq 0 ]
then then
echo_success echo $exec not found
touch $LOCKFILE exit 5
else
echo_failure
fi fi
echo -n "Starting varnish logging daemon: "
daemon --pidfile $pidfile $exec "$DAEMON_OPTS"
echo echo
;; return $retval
stop) }
echo -n "Stopping varnish logging daemon: "
killproc -p $PIDFILE $DAEMON stop() {
RETVAL=$? echo -n "Stopping varnish daemon: "
if [ $RETVAL -eq 0 ] killproc $prog
then retval=$?
echo_success
rm -f $LOCKFILE $PIDFILE
else
echo_failure
fi
echo echo
;; [ $retval -eq 0 ] && rm -f $lockfile
status) return $retval
status -p $PIDFILE $PROCNAME }
RETVAL=$?
;; restart() {
restart|reload) stop
$0 stop start
$0 start }
RETVAL=$?
;; reload() {
condrestart) restart
if [ -f $PIDFILE ]; then }
$0 stop
$0 start force_reload() {
RETVAL=$? restart
fi }
;;
*) rh_status() {
echo "Usage: $0 {start|stop|status|restart|condrestart}" status -p $pidfile $prog
exit 1 }
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 esac
exit $RETVAL exit $?
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment