start-unit.sh 395 B

123456789101112131415161718
  1. #!/usr/bin/env bash
  2. NPROC=$(nproc)
  3. sed "s/{{NPROC}}/$NPROC/" unit-config.template.json > nginx-unit-config.json
  4. unitd --no-daemon --control unix:/var/run/control.unit.sock &
  5. # wait UNIT started
  6. sleep 1
  7. # PUT configure
  8. curl -X PUT \
  9. --data-binary @nginx-unit-config.json \
  10. --unix-socket /var/run/control.unit.sock \
  11. http://localhost/config
  12. # Then keep the container alive
  13. wait