最近在centOS上调试apache的时候,总会出现莫名其妙的错误,正常的流程应该是:
[root@centos7 Abble]# apachectl status;
* httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2018-05-09 22:37:27 CST; 5min ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 4667 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=0/SUCCESS)
Main PID: 4780 (/usr/sbin/httpd)
Status: "Total requests: 1; Current requests/sec: 0; Current traffic: 0 B/sec"
CGroup: /system.slice/httpd.service
|-4780 /usr/sbin/httpd -DFOREGROUND
|-4782 /usr/sbin/httpd -DFOREGROUND
|-4783 /usr/sbin/httpd -DFOREGROUND
|-4784 /usr/sbin/httpd -DFOREGROUND
|-4785 /usr/sbin/httpd -DFOREGROUND
`-4786 /usr/sbin/httpd -DFOREGROUND
May 09 22:37:27 centos7 systemd[1]: Starting The Apache HTTP Server...
May 09 22:37:27 centos7 systemd[1]: Started The Apache HTTP Server.
[root@centos7 Abble]# apachectl stop
[root@centos7 Abble]# apachectl status;
* httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: inactive (dead) since Wed 2018-05-09 22:42:44 CST; 5s ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 4837 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=0/SUCCESS)
Process: 4780 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=0/SUCCESS)
Main PID: 4780 (code=exited, status=0/SUCCESS)
Status: "Total requests: 1; Current requests/sec: 0; Current traffic: 0 B/sec"
May 09 22:37:27 centos7 systemd[1]: Starting The Apache HTTP Server...
May 09 22:37:27 centos7 systemd[1]: Started The Apache HTTP Server.
May 09 22:42:43 centos7 systemd[1]: Stopping The Apache HTTP Server...
May 09 22:42:44 centos7 systemd[1]: Stopped The Apache HTTP Server.
[root@centos7 Abble]# ps -ef | grep httpd
root 4850 4553 0 22:43 pts/0 00:00:00 grep --color=auto httpd
[root@centos7 Abble]# apachectl start
[root@centos7 Abble]# ps -ef | grep httpd
root 4860 1 0 22:44 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 4862 4860 0 22:44 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 4863 4860 0 22:44 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 4864 4860 0 22:44 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 4865 4860 0 22:44 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 4866 4860 0 22:44 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
root 4870 4553 0 22:44 pts/0 00:00:00 grep --color=auto httpd
[root@centos7 Abble]#
出错时,start和stop命令都不起作用。目前我的解决方法是:
利用ps -ef
找到相应的进程号,然后kill
,再重新start
。当然,学习的最好方式就是man
或者 --help
有机会还是要找找出错的原因?这里先抛下个记录,,下次会遇到的!
网友评论