5
# Required-Start: $local_fs $remote_fs $network
6
# Required-Stop: $local_fs $remote_fs $network
7
# Default-Start: 2 3 4 5
9
# Short-Description: Start HTTP accelerator log daemon
10
# Description: This script provides logging for varnish
13
# Source function library
14
. /lib/lsb/init-functions
17
DESC="HTTP accelerator log deamon"
18
PATH=/sbin:/bin:/usr/sbin:/usr/bin
20
PIDFILE=/run/$NAME/$NAME.pid
21
LOGFILE=/var/log/varnish/varnish.log
23
DAEMON_OPTS="-a -w ${LOGFILE} -D -P $PIDFILE"
25
# Include defaults if available
26
if [ -f /etc/default/$NAME ] ; then
30
# If unset, or set to "0" or "no", exit
31
if [ -z "${VARNISHLOG_ENABLED}" ] || \
32
[ "${VARNISHLOG_ENABLED}" = "0" ] || \
33
[ "${VARNISHLOG_ENABLED}" = "no" ]; then
37
test -x $DAEMON || exit 0
40
output=$(/bin/tempfile -s.varnish)
41
log_daemon_msg "Starting $DESC" "$NAME"
43
if start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
44
--chuid $USER --exec ${DAEMON} -- ${DAEMON_OPTS} \
45
> ${output} 2>&1; then
56
log_daemon_msg "Stopping $DESC" "$NAME"
57
if start-stop-daemon --stop --quiet --pidfile $PIDFILE \
58
--retry 10 --exec $DAEMON; then
66
log_daemon_msg "Reloading $DESC" "$NAME"
67
if kill -HUP $(cat $PIDFILE) >/dev/null 2>&1; then
76
status_of_proc -p "${PIDFILE}" "${DAEMON}" "${NAME}"
80
create_pid_directory() {
81
install -o $USER -g $USER -d $(dirname $PIDFILE)
102
log_success_msg "Usage: $0 {start|stop|restart|force-reload|reload}"