qmail启动报错日志 alert: cannot start: unable to open mutex

突然发现qmail的队列积压了很多

然后就想办法清理队列

/var/qmail/bin/qmailctl stop

find /var/qmail/queue/ -type f -exec rm {} \;

这下痛快了,队列下去了,然后启动qmail,查看启动进程

不对劲,qmail进程没完全起来

[root@XKWB3403 qmail-send]# ps aux |grep qmail |grep -v grep |awk '{print $11}'
supervise
supervise
supervise
/usr/local/bin/tcpserver
/usr/local/bin/multilog
/usr/local/bin/multilog
/usr/local/bin/tcpserver
/usr/local/bin/multilog
[qmail-send]
/var/qmail/bin/qmail-smtpd
bin/qmail-queue

查看qmai-send日志

[root@XKWB3403 qmail-send]# tail -f current |tai64nlocal
2011-11-02 20:45:39.375806500 alert: cannot start: unable to open mutex
2011-11-02 20:45:40.400421500 alert: cannot start: unable to open mutex
2011-11-02 20:45:41.421744500 alert: cannot start: unable to open mutex
2011-11-02 20:45:42.464617500 alert: cannot start: unable to open mutex
2011-11-02 20:45:43.461939500 alert: cannot start: unable to open mutex
2011-11-02 20:45:44.485473500 alert: cannot start: unable to open mutex
2011-11-02 20:45:45.506098500 alert: cannot start: unable to open mutex
2011-11-02 20:45:46.525964500 alert: cannot start: unable to open mutex
2011-11-02 20:45:47.549317500 alert: cannot start: unable to open mutex
2011-11-02 20:45:48.569603500 alert: cannot start: unable to open mutex
2011-11-02 20:45:49.588864500 alert: cannot start: unable to open mutex
2011-11-02 20:45:50.610483500 alert: cannot start: unable to open mutex

我一下子傻眼了,这是啥玩意,立马google求助

急救措施就是

[root@XKWB3403 qmail-send]# cd /var/qmail/queue/lock/


[root@XKWB3403 lock]# ls
trigger


[root@XKWB3403 lock]# touch /var/qmail/queue/lock/sendmutex


[root@XKWB3403 lock]# ls -l sendmutex
-rw-r--r-- 1 root root 0 Nov 2 20:49 sendmutex


[root@XKWB3403 lock]# chown qmails:qmail sendmutex


[root@XKWB3403 lock]# ls -l
total 4
-rw-r--r-- 1 qmails qmail 0 Nov 2 20:49 sendmutex
prw--w--w- 1 qmails qmail 0 Nov 2 20:49 trigger

再次启动qmail

/var/qmail/bin/qmailctl start

查看进程,几个关键的qmail进程起来了

[root@XKWB3403 lock]# ps aux |grep qmail |grep -v grep |awk '{print $11}'|sort|uniq
bin/qmail-queue
qmail-clean
qmail-lspawn
qmail-remote
qmail-rspawn
qmail-send
supervise
/usr/local/bin/multilog
/usr/local/bin/tcpserver
/var/qmail/bin/qmail-smtpd

再去查看一下qmail日志,OK了

*********************************************************************

原来是我清除队列的时候将queue目录下的sendmutex文件和tcpto文件删掉了

而且没有重建

提醒大家清除队列的正确操作:

find /var/qmail/queue -type f |xargs rm

touch /var/qmail/queue/lock/sendmutex
touch /var/qmail/queue/lock/tcpto
chown qmails.qmail /var/qmail/queue/lock/sendmutex
chown qmailr.qmail /var/qmail/queue/lock/tcpto

或者是安装了qmail-remove工具

或者find /var/qmail/queue/$i -type f -exec rm {} \;

*********************************************************************

总之又吸取教训了

你可能感兴趣的:(alert)