mkdir -pv /root/sh
cat << EOF >> /root/sh/qmailstart.sh
#!/bin/sh
#
service qmail-start start
service qmail-smtpd start
service qmail-smtpd-ssl start
service courier-authdaemond start
service courier-imap-pop3d start
service courier-imap-pop3d-ssl start
service courier-imap-imapd start
service courier-imap-imapd-ssl start
service sa-spamd start
EOF
cat << EOF >> /root/sh/qmailstop.sh
#!/bin/sh
#
service qmail-start stop
service qmail-smtpd stop
service qmail-smtpd-ssl stop
service courier-authdaemond stop
service courier-imap-pop3d stop
service courier-imap-pop3d-ssl stop
service courier-imap-imapd stop
service courier-imap-imapd-ssl stop
service sa-spamd stop
EOF
chmod -v +x /root/sh/qmail*.sh
その上で、
vi /usr/local/etc/qmHandle.conf
# This is if you have FreeBSD with its qmail package
our ($stopqmail) = 'service qmail.sh stop';
our ($startqmail) = 'service qmail.sh start';
の箇所を
# This is if you have FreeBSD with its qmail package
our ($stopqmail) = '/root/sh/qmailstop.sh';
our ($startqmail) = '/root/sh/qmailstart.sh';
と書き換えます。
4. 操作
キューの状態を参照するには
qmHandle [-option]
で、普段使うのは
オプション
意味
-l
ローカル・リモート双方のキューを参照
-L
ローカル(local)キューを参照
-R
リモート(remote)キューを参照
-dN
キュー番号 N を削除
-D
全キューを削除
のいずれかになります。
試しにわたしのサーバで動作させてみます。
$ qmHandle -l
3603593 (22, 22/3603593)
Return-path:
From: MAILER-DAEMON@hogehoge.ne.jp
To: adminuketr@praiseband-glow.info
Subject: failure notice
Date: 3 Jun 2015 14:30:53 +0900
Size: 5978 bytes
・・・
3603592 (21, 21/3603592)
Return-path:
From: MAILER-DAEMON@hogehoge.ne.jp
To: infouzlyk@speechi.net
Subject: failure notice
Date: 4 Jun 2015 00:48:40 +0900
Size: 5878 bytes
Total messages: 6
Messages with local recipients: 0
Messages with remote recipients: 6
Messages with bounces: 0
Messages in preprocess: 0