install-pm2-www.sh 659 B

123456789101112131415161718192021222324
  1. #!/usr/bin/env bash
  2. echo "DBG:install-pm2-www - START"
  3. if [ ! -f "/usr/local/bin/pm2" ]; then
  4. echo "/usr/local/bin/pm2 not exist! INSTALL: npm install -g pm2"
  5. exit 1
  6. fi
  7. if [ -f "/usr/local/bin/pm2-www" ]; then
  8. rm "/usr/local/bin/pm2-www"
  9. fi
  10. if [ ! -f "/usr/local/bin/pm2-www" ]; then
  11. echo '#!/usr/bin/env bash' > "/usr/local/bin/pm2-www"
  12. echo '' >> "/usr/local/bin/pm2-www"
  13. echo 'sudo -u _www HOME=/Library/WebServer /usr/local/bin/pm2 "$@"' >> "/usr/local/bin/pm2-www"
  14. chmod +x "/usr/local/bin/pm2-www"
  15. fi
  16. if [ ! -f "/usr/local/bin/pm2-wwwX" ]; then
  17. echo "pm2-www not installed!"
  18. exit 1
  19. fi
  20. echo "DBG:install-pm2-www - END."