File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / spawn-fcgi / doc / run-generic
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Mon Oct 14 15:24:39 2013 UTC (11 years, 5 months ago) by misho
Branches: spawn-fcgi, MAIN
CVS tags: v1_6_3, HEAD
1.6.3

    1: #!/bin/bash
    2: # Use this as a run script with daemontools or runit
    3: 
    4: ## ABSOLUTE path to the spawn-fcgi binary
    5: SPAWNFCGI="/usr/bin/spawn-fcgi"
    6: 
    7: ## ABSOLUTE path to the FastCGI application (php-cgi, dispatch.fcgi, ...)
    8: FCGIPROGRAM="/usr/bin/php5-cgi"
    9: 
   10: ## bind to unix socket
   11: FCGISOCKET="/var/run/lighttpd/your-fcgi-app.sock"
   12: 
   13: # allowed environment variables separated by spaces
   14: ALLOWED_ENV="PATH USER"
   15: 
   16: ## if this script is run as root switch to the following user
   17: USERID=xxx
   18: SOCKUSERID=www-data
   19: #CHROOT=/home/www/
   20: 
   21: #RAILS_ENV="production"
   22: #export RAILS_ENV
   23: 
   24: 
   25: ################## no config below this line
   26: 
   27: exec 2>&1
   28: 
   29: if test x$PHP_FCGI_CHILDREN = x; then
   30:   PHP_FCGI_CHILDREN=4
   31: fi
   32: 
   33: ALLOWED_ENV="$ALLOWED_ENV RAILS_ENV"
   34: 
   35: if test x$UID = x0; then
   36:   EX="$SPAWNFCGI -n -s $FCGISOCKET -u $USERID -U $SOCKUSERID -C $PHP_FCGI_CHILDREN -- $FCGIPROGRAM"
   37: else
   38:   EX="$SPAWNFCGI -n -s $FCGISOCKET -C $PHP_FCGI_CHILDREN -- $FCGIPROGRAM"
   39: fi
   40: 
   41: # copy the allowed environment variables
   42: E=
   43: 
   44: for i in $ALLOWED_ENV; do
   45:   E="$E $i=${!i}"
   46: done
   47: 
   48: # clean environment and set up a new one
   49: exec env - $E $EX

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>