Skip to content
Advertisement

starting apachectl from bash

I am writing a bash file. I need to start apachectl from my bash file. so i wrote:

apachectl start

When I run it with root, an error occurred:

apachectl: command not found

I searched and I found that, I should be super user with su - not su

Now, I want to know:

  • why this error occurred?

  • How could i run it with su?

Advertisement

Answer

The command not found error is because “apachectl” is not in your path. Simply use the full path of the command, e.g.

/etc/init.d/apachectl start

If you get a permission denied error, then you need to run as a different user. That is a different problem though.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement