daemon として exim を動かす
exim は、結構小さな MTA のようで(の割りに多機能のようだが)、 inetd 経由 で使用していれば、常駐するプロセスは存在しない。その代わり、queue に溜まったメッセージの面倒を見るために、 15分毎に exim -q を cron で起動している。この cron の log がかなり鬱陶しい ;(

/usr/share/doc/exim/READMI.Debian.gz には次のようにある。

Exim will install by default to run from inetd.conf. To instead run exim
as a daemon:

1. Disable the entry in /etc/inetd.conf. The startup script

   (/etc/init.d/exim) will notice this and start a daemon

2. You might want to change the contents of /etc/cron.d/exim since the queue

   will be run from the daemon instead

@ inetd.conf の smpt サービスを無効にする:
# update-inetd --verbose --disable smtp
Processing /etc/inetd.conf
Processing service `smtp' ... disabled
inetd への SIGHUP は勝手に送ってくれるので、inetd を再起動する必要は無い。

# diff inetd.conf.old inetd.conf
33c33< smtp stream tcp nowait mail /usr/sbin/exim exim -bs

    • -

> ## smtp stream tcp nowait mail /usr/sbin/exim exim -bs
実際は update-inetd をしても、変更前のファイルが保存されるわけじゃない。

# ls -R /etc/rc?.d/S??exim
/etc/rc2.d/S20exim@ /etc/rc4.d/S20exim@
/etc/rc3.d/S20exim@ /etc/rc5.d/S20exim@
exim パッケージをインストールした状態なら、startup script は既に配置されているはず。この script は inetd から起動する設定にしていると、何もせずに終わるやつ。

@ cron の設定を外す:
daemon が queue の面倒をみてくれるようになるので、cron で 15分毎に走らせていた exim -q を止める。 /etc/cron.d/exim の中身を変更するが、別に消しても構わないかも。

# diff exim~ exim
4c4< 08,23,38,53 * * * * mail
if [ -x /usr/sbin/exim -a -f /etc/exim/exim.conf ]; then /usr/sbin/exim -q ; fi

    • -

> #08,23,38,53 * * * * mail
if [ -x /usr/sbin/exim -a -f /etc/exim/exim.conf ]; then /usr/sbin/exim -q ; fi
## 実際には mail と if の間で改行は無く一行
多分 cron が /etc/cron.d/exim の変更を感知して、設定を reload しているはずだが、心配なら /etc/init.d/cron restart しても良い。 syslog を確認。

daemon 起動:
# /etc/init.d/exim start
Starting MTA: exim.
これだけ。

/etc/init.d/exim では exim が -bd -q30m というオプションで実行される。 -bd は daemon として動くオプションで、詳細は spec.txt で。 -q30m は 30分毎に queue のおさらいをするというもの。

Dec 26 18:43:46 exim1 exim[2841]: 2001-12-26 18:43:46 Start queue run: pid=2841
Dec 26 18:43:46 exim1 exim[2841]: 2001-12-26 18:43:46 End queue run: pid=2841
実は syslog にしても、この -q30m のおかげで上のように syslog が吐かれちゃう。これを抑制するには log_level と log_queue_run_level を使う。

log_level = 5
log_queue_run_level = 6
log_level の default は 5 で、log_queue_run_level の default は 0 だ。
"Start queue run" と "End queue run" の出力を抑制するには log_level より大きな値を log_queue_run_level に設定すれば良い。