run.sh 723 B

12345678910111213141516171819202122232425262728
  1. #!/bin/bash
  2. CPU_COUNT=$(nproc)
  3. # one fastcgi instance for each thread
  4. # load balanced by nginx
  5. socket_index_start=1
  6. socket_index_end=$(($socket_index_start+$CPU_COUNT))
  7. # To debug, use --printlog --verbose --loglevels=All
  8. for port in $(seq $socket_index_start $socket_index_end); do
  9. MONO_OPTIONS=--gc=sgen fastcgi-mono-server4 --applications=/:/aspnet/src --filename=/tmp/fastcgi-mono-server4-$port --socket=unix &
  10. done
  11. sleep 5s
  12. # nginx
  13. conf="upstream mono {\n"
  14. for port in $(seq $socket_index_start $socket_index_end); do
  15. chmod -R 777 /tmp/fastcgi-mono-server4-$port
  16. conf+="\tserver unix:/tmp/fastcgi-mono-server4-${port};\n"
  17. done
  18. conf+="}"
  19. echo -e $conf > nginx.upstream.conf
  20. nginx -c /aspnet/nginx.conf
  21. wait