Hi i have a java application that starts/stops/restart Apache and it should also check for its status, so i have looked how checking for status of apache and it appears that you have to check for the state of the service, problem is that when i use
apachectl startthe service httpd is still not started, is that normal ?
i check for the service state by doing
service httpd status.
[root@lxrdcpsm ~]# service httpd status
httpd is stopped
[root@lxrdcpsm ~]# /apps/apache/2.4.4/bin/apachectl start
httpd (pid 20502) already running
[root@lxrdcpsm ~]# service httpd status
httpd is stopped
[root@lxrdcpsm ~]# /apps/apache/2.4.4/bin/apachectl stop
[root@lxrdcpsm ~]# service httpd status
httpd is stopped
[root@lxrdcpsm ~]# /apps/apache/2.4.4/bin/apachectl start
[root@lxrdcpsm ~]# service httpd status
httpd is stopped
[root@lxrdcpsm ~]# 2 Answers
Please try the below commands in your terminal..
[root@localhost ~]# service httpd startOR
[root@localhost ~]# /etc/init.d/httpd startAfter starting it will be running until the system is shut down. While checking status you will get output something like this.
[root@localhost ~]# /etc/init.d/httpd status
httpd (pid 2107) is running...If you want to start this service automatically on system boot use the below command.
[root@localhost ~]#chkconfig --level 3 httpd onWhere 3 is your current runlevel.
It isn't started because you didn't start it.
Nowadays the new utility responsible for managing services is systemctl and the command to start Apache is
systemctl start httpdHowever, one can keep on using the old terminology: service httpd start
Assuming that you want it to start with the system, use the following command:
chkconfig httpd on