Linux Can';t停止/重新启动Apache2服务
试图停止Apache2服务,但出现PID错误:Linux Can';t停止/重新启动Apache2服务,linux,debian,apache2,init.d,Linux,Debian,Apache2,Init.d,试图停止Apache2服务,但出现PID错误: #service apache2 stop [FAIL] Stopping web server: apache2 failed! [....] There are processes named 'apache2' running which do not match your pid file which are left untouched in the name of safety, Plea[warnview the situation
#service apache2 stop
[FAIL] Stopping web server: apache2 failed!
[....] There are processes named 'apache2' running which do not match your pid file which are left untouched in the name of safety, Plea[warnview the situation by hand. ... (warning).
试图杀死这些进程:
#kill -9 $(ps aux | grep apache2 | awk '{print $2}')
但它们再次繁殖:
#ps aux | grep apache2
root 19279 0.0 0.0 4080 348 ? Ss 05:10 0:00 runsv apache2
root 19280 0.0 0.0 4316 648 ? S 05:10 0:00 /bin/sh /usr/sbin/apache2ctl -D FOREGROUND
root 19282 0.0 0.0 91344 5424 ? S 05:10 0:00 /usr/sbin/apache2 -D FOREGROUND
www-data 19284 0.0 0.0 380500 2812 ? Sl 05:10 0:00 /usr/sbin/apache2 -D FOREGROUND
www-data 19285 0.0 0.0 380500 2812 ? Sl 05:10 0:00 /usr/sbin/apache2 -D FOREGROUND
虽然进程正在运行,但我无法连接到端口80上的服务器/var/log/apache2/error.log.1在执行kill-9时没有新消息。
在我尝试重新启动之前,一切都很顺利。
在Debian上运行:Linux adara 3.2.0-4-amd64#1 SMP Debian 3.2.54-2 x86_64 GNU/Linux
UPD:
还尝试了apache2ctl:
#/usr/sbin/apache2ctl -k stop
AH00526: Syntax error on line 76 of /etc/apache2/apache2.conf:
PidFile takes one argument, A file for logging the server process ID
Action '-k stop' failed.
The Apache error log may have more information.
但是/var/run/apache2中没有pid文件
我是linux新手,看起来它必须与启动脚本有关,但不知道具体是什么。您可以尝试使用Apache官方文档进行停止/重新启动操作。
下面是查找端口80上运行的进程的命令 lsof-i tcp:80 使用PID终止进程。重新启动系统一次,检查是否有任何启动脚本正在执行并使用端口80阻止您启动服务 对于启动脚本,您可以检查
/etc/init.d/或/etc/rc.local或crontab-ekill不起作用(进程重新生成),ApacheCtl-k stop需要pid文件,但它丢失了此服务器上的其他服务,不幸的是,无法如此轻松地重新启动它,但如果找不到其他解决方案,我以后肯定会这样做。lsof-i tcp:80不返回任何内容