首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >monit无法启动apache

monit无法启动apache
EN

Server Fault用户
提问于 2013-01-29 12:28:20
回答 1查看 3.4K关注 0票数 0

我在运行Apache,并试图通过Monit监控它。监视似乎运行良好,但是当Apache关闭时,Monit无法启动它。

Monit确实检测到它已关闭,但是start命令失败了。

下面是monit配置

代码语言:javascript
复制
check process httpd with pidfile /var/run/httpd.pid
start program = "/usr/bin/apachestart start"
stop program = "/etc/init.d/httpd stop"
if failed host 127.0.0.1 port 80
protocol http then restart
if 5 restarts within 5 cycles then timeout

这是指Apache的启动脚本,其中包括以下内容:

代码语言:javascript
复制
# cat /usr/bin/apachestart
## start Apache with default settings
ulimit -l 256;
ulimit -s 56000;
/usr/sbin/apachectl start;

这个脚本设置了几个参数,这些参数似乎是这个特定的Apache/PHP设置所必需的。从命令行作为根运行时工作正常,但显然,对于Monit来说,这是一个问题。

在调试模式下运行monit (从"monit -Iv“开始)时,我得到以下信息

代码语言:javascript
复制
monit: pidfile '/var/run/httpd.pid' does not exist
'httpd' process is not running
-------------------------------------------------------------------------------
    monit [0x40de4d]
    monit(LogError+0x9f) [0x40e59f]
    monit(Event_post+0x406) [0x40ba96]
    monit(check_process+0x98) [0x41d798]
    monit(validate+0x1b3) [0x41dbf3]
    monit [0x410547]
    monit(main+0x492) [0x410d72]
    /lib64/libc.so.6(__libc_start_main+0xf4) [0x30f961d994]
    monit [0x408e39]
-------------------------------------------------------------------------------
Does not exist notification is sent to frank@avalonnet.com
Does not exist notification is sent to tom@avalonnet.com
'httpd' trying to restart
Monitoring disabled -- service httpd
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
'httpd' start: /usr/bin/apachestart
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
'httpd' failed to start
-------------------------------------------------------------------------------
    monit [0x40de4d]
    monit(LogError+0x9f) [0x40e59f]
    monit(Event_post+0x406) [0x40ba96]
    monit [0x409b7a]
    monit(control_service+0xcb) [0x409d8b]
    monit [0x40b3ae]
    monit(Event_post+0x445) [0x40bad5]
    monit(check_process+0x98) [0x41d798]
    monit(validate+0x1b3) [0x41dbf3]
    monit [0x410547]
    monit(main+0x492) [0x410d72]
    /lib64/libc.so.6(__libc_start_main+0xf4) [0x30f961d994]
    monit [0x408e39]
-------------------------------------------------------------------------------
Execution failed notification is sent to ...

知道为什么monit不能启动Apache吗?

EN

回答 1

Server Fault用户

发布于 2013-01-29 12:34:59

/usr/sbin/apachectl start没有正确地设置httpd的PID文件。

由于Monit文件通过/var/run/httpd.pid跟踪进程,所以应该使用/etc/init.d/httpd start作为启动程序。

如果需要附加参数,可以将它们放在另一个配置文件中。这在一定程度上取决于您使用的Linux版本。

票数 1
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/473422

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档