7

I'm using the standard Apache server in my Mac OS X 10.8 (Mountain Lion) installation, and find that when running

sudo apachectl restart

The command simply shows the prompt when finished, whether Apache failed to start or not. There is no feedback, until you refresh your browser to see if localhost still works or not.

Is there a way to configure Apache to be a bit more verbose?

Josef van Niekerk
  • 501
  • 4
  • 8
  • 15

2 Answers2

14

You could try:

sudo apachectl -e info -k restart

The -e option is equivalent to the LogLevel directive, but it logs to your terminal. Replace info with debug for more details.

The apachectl script and the httpd binary have slightly conflicting arguments, so you need to use -k with stop, start, restart and graceful (the command keywords alone will not work as expected when other arguments are present). To get configcheck use

sudo apachectl -e info -t

This applies to Apache on any platform using the standard apachectl script.

This answer has another option, but I consider strace (and dtrace, ktrace, truss) to be more of a last resort...

mr.spuratic
  • 3,400
  • 19
  • 14
0

I just tend to echo $? to get the exit status. Or do a quick ps aux | grep apache or ps aux | grep httpd (depending on the OS) to check for the service after restarting.

samuelkf
  • 383
  • 3
  • 8