You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
752 B

  1. #!/bin/sh
  2. if [ -f "/etc/nginx/luci_nginx.conf" ] && [ -f "/etc/nginx/nginx.conf" ]; then
  3. if [ ! "$(cat '/etc/nginx/nginx.conf' | grep 'luci_uwsgi.conf')" ]; then
  4. mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf_old
  5. mv /etc/nginx/luci_nginx.conf /etc/nginx/nginx.conf
  6. core_number=$(grep -c ^processor /proc/cpuinfo)
  7. sed -i "3s/.*/worker_processes "$core_number";/" /etc/nginx/nginx.conf
  8. if [ -n "$(pgrep uhttpd)" ]; then
  9. /etc/init.d/uhttpd stop
  10. /etc/init.d/uhttpd disable
  11. fi
  12. if [ -n "$(pgrep nginx)" ]; then
  13. /etc/init.d/nginx restart
  14. else
  15. /etc/init.d/nginx start
  16. fi
  17. if [ -n "$(pgrep uwsgi)" ]; then
  18. /etc/init.d/uwsgi restart
  19. else
  20. /etc/init.d/uwsgi start
  21. fi
  22. else
  23. rm /etc/nginx/luci_nginx.conf
  24. fi
  25. fi
  26. exit 0