starting apachectl from bash

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.


In shell scripts you should use full paths in order to execute command unless directory with executable already in $PATH. For instance, find where apachectl binary is located:

which apachectl

or

whereis apachectl

and you will get something like:

/usr/local/sbin/apachectl

So, use that.

Tags:

Linux

Apache

Bash