mint.sh 723 B

12345678910111213141516171819202122232425262728293031
  1. #!/bin/bash
  2. set -e
  3. # -----------------------------------------------------------------------------
  4. if [[ "$EUID" -ne 0 ]]; then
  5. echo "please run this script as root."
  6. exit 1
  7. fi
  8. . /etc/os-release
  9. if [[ "$ID" != "ubuntu" ]]; then
  10. echo "unsupported distribution $ID"
  11. exit 1
  12. fi
  13. # -----------------------------------------------------------------------------
  14. if [[ "$#" -eq 1 && "$1" == "diagnose" ]]; then
  15. php --version
  16. echo "NodeJs: $(node -v)"
  17. echo "npm: $(npm -v)"
  18. composer diagnose
  19. elif [[ "$#" -eq 2 && "$1" == "fcgi" ]]; then
  20. echo "start FastCGI server listening on 0.0.0.0:$2"
  21. php-fpm -F -R
  22. else
  23. echo "unsupported args, USAGE: $0 diagnose|fcgi PORT"
  24. exit 1
  25. fi
  26. exit 0