早上7点多起来的时候,接到报警,发现主站后台的apache挂了,上去启动了下,没起来;
查看错误日志 发现有如下显示
[root@houtaicms logs]# tail -f error_log
[Wed Mar 21 07:20:07 2012] [warn] pid file /usr/local/apache2.2.20/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Wed Mar 21 07:20:07 2012] [emerg] (28)No space left on device: Couldn't create accept lock (/usr/local/apache2.2.20/logs/accept.lock.11713) (5)
[Wed Mar 21 07:20:08 2012] [warn] pid file /usr/local/apache2.2.20/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Wed Mar 21 07:20:08 2012] [emerg] (28)No space left on device: Couldn't create accept lock (/usr/local/apache2.2.20/logs/accept.lock.11735) (5)


于是联想到去年十月份我们我们主站后台出现的类似的问题,ipcs查看了下,果然如此,
[root@houtaicms logs]# ipcs -s|grep www
0x00000000 0          www       600        1
0x00000000 32769      www       600        1
0x00000000 98306      www       600        1
............................................
0x00000000 4718718    www       600        1
0x00000000 4751487    www       600        1

执行如下命令清除,
[root@houtaicms logs]# ipcs -s | grep www|perl -e 'while () { @a=split(/\s+/); print `ipcrm sem $a[1]`}'
resource(s) deleted
...................
resource(s) deleted
resource(s) deleted

再次执行apache重启,发现可以起来了.
[root@houtaicms logs]# /usr/local/apache2.2.20/bin/apachectl -t
Syntax OK
[root@houtaicms logs]# /usr/local/apache2.2.20/bin/apachectl start

[root@houtaicms logs]# netstat -lntup
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name
tcp        0      0 0.0.0.0:5666                0.0.0.0:*                   LISTEN      26256/nrpe      
tcp        0      0 127.0.0.1:199               0.0.0.0:*                   LISTEN      2457/snmpd      
tcp        0      0 0.0.0.0:873                 0.0.0.0:*                   LISTEN      28844/rsync     
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      21869/sshd      
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      12282/httpd     


[root@houtaicms logs]# date
Wed Mar 21 07:29:29 CST 2012
首先用ipcs命令列出了共享内存、共享队列,共享信号量。
显示出当前系统中有共享内存,共享信号量,没有共享队列。
然后执行ipcrm -m 262145清楚共享semid=262145的共享内存。
执行ipcrm -s 884736清楚共享信号量semid=884736的共享信号量。
最后执行ipcs查看共享内存、共享队列,共享信号量信息,发现全都没有了,说明上面的ipcrm清楚共享内存和共享信号量成功