sudo service apache2 restart: already running

Tags:

Answer: 1

27 hours ago

As the title says, when I run sudo service apache2 restart, the message returned says that Apache is already running. However, the service is stopped (if milliseconds later).

If I run sudo service apache2 start, everything works fine. I assume the script isn't waiting (long enough) for the process to end... I have two other servers (they're all 12.04) with the same config, exact same init file (I did a diff), and they don't exhibit this behavior.

Also interesting is that when I start|stop|reload, they don't return the [OK] message. What gives?

Answer: 2

6 hours ago

It's possible for apache to get stuck and forget to remove its PID file (if it crashes, say).

Check if the file /var/run/apache2/apache2.pid exists. If it does, rm it.

Also check if there are apache processes running:

ps auxwww | grep apache

If there are, kill -9 them. Then you should be able to start apache via /etc/init.d/apache2 start.

Added by: Jocelyn Daniel V

Popular Search

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 1 2 3 4 5 6 7 8 9