Varnish gestione servizio e start-up (CENTOS)

Argomenti: 

Script per gestione servizio varnish (/etc/init.d/varnish):

#!/bin/bash
#
# varnish Control the varnish HTTP accelerator
#
# chkconfig: - 90 10
# description: Varnish is a high-perfomance HTTP accelerator
# processname: varnishd

# Source function library.
. /etc/rc.d/init.d/functions

# various paths
varnishd=/usr/sbin/varnishd
prog=varnishd
pidfile=/var/run/varnishd.pid
lockfile=/var/lock/subsys/varnishd
RETVAL=0

# startup options
options='-T localhost:87 -a :80 -f /etc/varnish/default.vcl -u varnish -g varnish -s file,/tmp/varnish_storage.bin'

# The semantics of these two functions differ from the way apachectl does
# things -- attempting to start while running is a failure, and shutdown
# when not running is also a failure. So we just do it the way init scripts
# are expected to behave here.
start() {
        echo -n $"Starting $prog: "
        daemon $varnishd $options
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && touch ${lockfile}
        return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
killproc $varnishd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
}

# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $varnishd
RETVAL=$?
;;
restart)
stop
start
;;
*)
echo $"Usage: $prog {start|stop|restart|status}"
exit 1
esac

exit $RETVAL

le prime righe permettono di utilizzare chkconfig per far partire il servizio allo start-up del sistema

chkconfig --add varnish
chkconfig --level 345 varnish on