varnishd

varnishd

 

  1. #!/bin/sh 
  2. # 
  3. # varnishd 
  4. # chkconfig: 3 99 15 
  5. # 
  6. # description: Varnish is a state-of-the-art, high-performance HTTP accelerator 
  7. # 
  8. # Source function library. 
  9.  
  10. . /etc/rc.d/init.d/functions 
  11.  
  12.  
  13. case "$1" in 
  14.   start) 
  15.         /usr/local/varnish/sbin/varnishd -n /data/varnish/varnish \ 
  16.                                  -f /usr/local/varnish/vcl.cnf \ 
  17.                                  -a :80 \ 
  18.                                  -s malloc,2G \ 
  19.                                  -g varnish \ 
  20.                                  -u varnish \ 
  21.                                  -p thread_pools=4  \ 
  22.                                  -p listen_depth=4096 \ 
  23.                                  -p thread_pool_min=2 \ 
  24.                                  -p thread_pool_max=300 \ 
  25.                                  -p thread_pool_timeout=180 \ 
  26.                                  -T 127.0.0.1:3500 \ 
  27.                                  -p client_http11=on \ 
  28.                                  -p backend_http11=on 
  29.  
  30.          /usr/local/varnish/bin/varnishncsa -n /data/varnish/varnish  -a -w /data/varnish/varnish/logs & 
  31.          exit 0 
  32.          ;; 
  33.   stop) 
  34.           ps uax|grep varnish|grep "vcl.cnf -a :80 -s"|grep -v "grep" | awk '{system("kill -9 "$2);}' 2>/dev/null 
  35.  
  36.           if [ $? -eq 0 ] 
  37.           then 
  38.              echo "Stop ... [Ok]" 
  39.              exit 0 
  40.           fi 
  41.           ;; 
  42.   restart) 
  43.           $0 stop 
  44.           $0 start 
  45.           ;; 
  46.    status) 
  47.           ps uax|grep varnish|grep "vcl.cnf -a :80 -s" 
  48.  
  49.           if [ $? -eq 0 ]  
  50.           then 
  51.               echo "Varnishd is running..." 
  52.           else 
  53.               echo "Varnishd is not running..." 
  54.           fi 
  55.           ;; 
  56.   *) 
  57.           echo $"Usage: $0 {start|stop}" 
  58.           exit 1 
  59. esac 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章