varnishd
- #!/bin/sh
- #
- # varnishd
- # chkconfig: 3 99 15
- #
- # description: Varnish is a state-of-the-art, high-performance HTTP accelerator
- #
- # Source function library.
- . /etc/rc.d/init.d/functions
- case "$1" in
- start)
- /usr/local/varnish/sbin/varnishd -n /data/varnish/varnish \
- -f /usr/local/varnish/vcl.cnf \
- -a :80 \
- -s malloc,2G \
- -g varnish \
- -u varnish \
- -p thread_pools=4 \
- -p listen_depth=4096 \
- -p thread_pool_min=2 \
- -p thread_pool_max=300 \
- -p thread_pool_timeout=180 \
- -T 127.0.0.1:3500 \
- -p client_http11=on \
- -p backend_http11=on
- /usr/local/varnish/bin/varnishncsa -n /data/varnish/varnish -a -w /data/varnish/varnish/logs &
- exit 0
- ;;
- stop)
- ps uax|grep varnish|grep "vcl.cnf -a :80 -s"|grep -v "grep" | awk '{system("kill -9 "$2);}' 2>/dev/null
- if [ $? -eq 0 ]
- then
- echo "Stop ... [Ok]"
- exit 0
- fi
- ;;
- restart)
- $0 stop
- $0 start
- ;;
- status)
- ps uax|grep varnish|grep "vcl.cnf -a :80 -s"
- if [ $? -eq 0 ]
- then
- echo "Varnishd is running..."
- else
- echo "Varnishd is not running..."
- fi
- ;;
- *)
- echo $"Usage: $0 {start|stop}"
- exit 1
- esac