apache2ctl-use-conf.patch 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. Index: httpd-2.2.17/support/apachectl.in
  2. ===================================================================
  3. --- httpd-2.2.17.orig/support/apachectl.in
  4. +++ httpd-2.2.17/support/apachectl.in
  5. @@ -43,19 +43,22 @@ ARGV="$@"
  6. # the path to your httpd binary, including options if necessary
  7. HTTPD='@exp_sbindir@/@progname@'
  8. #
  9. -# pick up any necessary environment variables
  10. -if test -f @exp_sbindir@/envvars; then
  11. - . @exp_sbindir@/envvars
  12. -fi
  13. -#
  14. # a command that outputs a formatted text version of the HTML at the
  15. # url given on the command line. Designed for lynx, however other
  16. # programs may work.
  17. -LYNX="@LYNX_PATH@ -dump"
  18. +if [ -x "@LYNX_PATH@" ]; then
  19. + LYNX="@LYNX_PATH@ -dump"
  20. +else
  21. + LYNX=none
  22. +fi
  23. #
  24. # the URL to your server's mod_status status page. If you do not
  25. # have one, then status and fullstatus will not work.
  26. STATUSURL="http://localhost:@PORT@/server-status"
  27. +# Source /etc/conf.d/apache2 for $HTTPD setting, etc.
  28. +if [ -r /etc/conf.d/apache2 ]; then
  29. + . /etc/conf.d/apache2
  30. +fi
  31. #
  32. # Set this variable to a command that increases the maximum
  33. # number of file descriptors allowed per child process. This is
  34. @@ -75,29 +78,39 @@ if [ "x$ARGV" = "x" ] ; then
  35. ARGV="-h"
  36. fi
  37. +function checklynx() {
  38. +if [ "$LYNX" = "none" ]; then
  39. + echo "The 'links' package is required for this functionality."
  40. + exit 8
  41. +fi
  42. +}
  43. +
  44. case $ARGV in
  45. -start|stop|restart|graceful|graceful-stop)
  46. - $HTTPD -k $ARGV
  47. - ERROR=$?
  48. +restart|graceful)
  49. + if $HTTPD $OPTIONS -t >&/dev/null; then
  50. + $HTTPD $OPTIONS -k $ARGV
  51. + ERROR=$?
  52. + else
  53. + echo "apachectl: Configuration syntax error, will not run \"$ARGV\":"
  54. + testconfig
  55. + fi
  56. ;;
  57. -startssl|sslstart|start-SSL)
  58. - echo The startssl option is no longer supported.
  59. - echo Please edit httpd.conf to include the SSL configuration settings
  60. - echo and then use "apachectl start".
  61. - ERROR=2
  62. +start|stop|graceful-stop)
  63. + $HTTPD $OPTIONS -k $ARGV
  64. + ERROR=$?
  65. ;;
  66. configtest)
  67. - $HTTPD -t
  68. - ERROR=$?
  69. + testconfig
  70. ;;
  71. status)
  72. + checklynx
  73. $LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } '
  74. ;;
  75. fullstatus)
  76. $LYNX $STATUSURL
  77. ;;
  78. *)
  79. - $HTTPD $ARGV
  80. + $HTTPD $OPTIONS $ARGV
  81. ERROR=$?
  82. esac