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.

nginx.sh 449B

123456789101112131415161718192021222324252627
  1. #!/bin/sh
  2. set -e
  3. out="/etc/nginx/sites-available/autogen"
  4. if ! [ -w "$out" ]; then
  5. echo "Must have write access to $out."
  6. exit 1
  7. fi
  8. cp "$out" "$out.bak"
  9. output="$(m4 -P -I ../conf/nginx nginx.m4)"
  10. echo "$output" \
  11. | sed '/^\s*$/d' \
  12. | tee "$out" >/dev/null
  13. if ! sudo nginx -t; then
  14. echo "Reverting to backup file."
  15. mv "$out.bak" "$out"
  16. else
  17. echo "Press enter to restart nginx."
  18. read _
  19. echo "Restarting..."
  20. systemctl restart nginx
  21. fi