php-framework-skeleton

Skeleton for php-framework
git clone git://git.finwo.net/misc/php-framework-skeleton
Log | Files | Refs

run.sh (791B)


      1 #!/usr/bin/env bash
      2 
      3 rm fifo.* 2>/dev/null
      4 
      5 test -v "$PORT" || PORT=5000
      6 XRARGS="-f -x -s http:0.0.0.0:$PORT"
      7 
      8 # Use a load-balancer if possible
      9 if command -v xr >/dev/null 2>/dev/null; then
     10   for i in {0..9} ; do
     11     XRARGS="$XRARGS -b 127.0.0.1:800$i"
     12     echo Starting handler on 800$i
     13     { while true ; do FIFO=$(hexdump -n 16 -v -e '/1 "%02X"' -e '/16 "\n"' /dev/urandom) ; mkfifo fifo.$FIFO ; nc -l -p 800$i < fifo.$FIFO | php web/index.php > fifo.$FIFO ; rm fifo.$FIFO ; done } &
     14   done;
     15   echo Starting load-balancer on $PORT
     16   echo xr $XRARGS
     17   xr $XRARGS
     18 else
     19   echo Starting on $PORT
     20   while true ; do FIFO=$(hexdump -n 16 -v -e '/1 "%02X"' -e '/16 "\n"' /dev/urandom) ; mkfifo fifo.$FIFO ; nc -l -p $PORT < fifo.$FIFO | php web/index.php > fifo.$FIFO ; rm fifo.$FIFO ; done
     21 fi
     22