分享
 
 
 

qmail的smtp与pop服务及相关日志完全解决方案

王朝other·作者佚名  2008-05-18
窄屏简体版  字體: |||超大  

注:

1. supervise相关文件目录为/raid/var/supervise

2. log相关文件目录为/raid/var/log,该目录及子目录的所有权限为qmaill:nofiles

3. qmail软件安装目录为/raid/var/qmail

4. vpopmail软件安装目录为/raid/var/vpopmail

一、 相关程序:

1. daemontool工具包提供的svscan、supervise、mutilog、svc、setuidgid、softlimit、svstat程序。

2. ucspi-tcp工具包提供的tcpserver、tcprules程序。

二、 supervise的目录结构:(假定为/raid/var/supervise目录)

drwxr-sr-t root other qmail-pop3d

-rwxr-xr-x root other run

drwxr-sr-x root other log

-rwxr-xr-x root other run

drwxr-xr-t 4 root other qmail-send

-rwxr-xr-x root other run

drwxr-xr-x root other log

-rwxr-xr-x root other run

drwxr-xr-t root other qmail-smtpd

-rwxr-xr-x root other run

drwxr-xr-x root other log

-rwxr-xr-x root other run

三、各目录相关run文件:

1. /raid/var/supervise/qmail-pop3d/run文件:

#!/bin/sh

exec /usr/local/bin/tcpserver -H -R -v 0 pop3 \

/raid/var/qmail/bin/qmail-popup gzmail.ezhong.com \

/raid/var/vpopmail/bin/vchkpw \

/raid/var/qmail/bin/qmail-pop3d Maildir 2>&1

2. /raid/var/supervise/qmail-pop3d/log/run文件:

#!/bin/sh

exec /usr/local/bin/setuidgid qmaill \

/usr/local/bin/multilog t /raid/var/log/pop3d

3. /raid/var/supervise/qmail-send/run文件:

#!/bin/sh

exec env - PATH="/raid/var/qmail/bin: $PATH" \

qmail-start `cat /raid/var/qmail/control/defaultdelivery`

Note:

使用以下命令建立defaultdelivery文件,举例如下:

echo ./Maildir/ >/raid/var/qmail/control/defaultdelivery

MailboxFormat---Name-----Location---defaultdelivery

mbox Mailbox  $HOME ./Mailbox

maildir Maildir  $HOME ./Maildir/

4. /raid/var/supervise/qmail-send/log/run文件:

#!/bin/sh

exec /usr/local/bin/setuidgid qmaill \

/usr/local/bin/multilog t /raid/var/log/qmail

5. /raid/var/supervise/qmail-smtpd/run文件:

#!/bin/sh

QMAILDUID=`/usr/xpg4/bin/id -u qmaild`

NOFILESGID=`/usr/xpg4/bin/id -g qmaild`

MAXSMTPD=`cat /raid/var/qmail/control/concurrencyincoming`

exec /usr/local/bin/softlimit -m 4000000 \

/usr/local/bin/tcpserver -v -p -x /etc/tcp.smtp.cdb -c " $MAXSMTPD" \

-u " $QMAILDUID" -g " $NOFILESGID" 0 smtp /raid/var/qmail/bin/qmail-smtpd 2>&1

Note:

A.建立concurrencyincoming控制文件:

echo 20 > /raid/var/qmail/control/concurrencyincoming

chmod 644 /raid/var/qmail/control/concurrencyincoming

B.建立SMTP访问控制文件:

echo 127.:allow,RELAYCLIENT="" >>/etc/tcp.smtp

/etc/init.d/qmail cdb

6. /raid/var/supervise/qmail-smtpd/log/run文件:

#!/bin/sh

exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t /raid/var/log/smtpd

四、qmail的启动脚本:(假定为/etc/init.d/qmail文件)

#!/usr/bin/sh

PATH=/raid/var/qmail/bin:/usr/local/bin:/usr/bin:/bin

export PATH

case " $1" in

start)

echo "Starting qmail (smtpd+pop3d) & logging: svscan"

cd /raid/var/supervise

nohup env - PATH=" $PATH" svscan &

echo  $! > /raid/var/pid/svscan.pid

;;

stop)

echo "Stopping qmail (smtpd+pop3d) & logging: svscan"

kill `cat /raid/var/pid/svscan.pid`

/usr/local/bin/svc -dx /raid/var/supervise/qmail-smtpd

/usr/local/bin/svc -dx /raid/var/supervise/qmail-send

/usr/local/bin/svc -dx /raid/var/supervise/qmail-pop3d

/usr/local/bin/svc -dx /raid/var/supervise/qmail-smtpd/log

/usr/local/bin/svc -dx /raid/var/supervise/qmail-send/log

/usr/local/bin/svc -dx /raid/var/supervise/qmail-pop3d/log

;;

stat)

/usr/local/bin/svstat /raid/var/supervise/qmail-smtpd

/usr/local/bin/svstat /raid/var/supervise/qmail-send

/usr/local/bin/svstat /raid/var/supervise/qmail-pop3d

/usr/local/bin/svstat /raid/var/supervise/qmail-smtpd/log

/usr/local/bin/svstat /raid/var/supervise/qmail-send/log

/usr/local/bin/svstat /raid/var/supervise/qmail-pop3d/log

;;

doqueue|alrm)

echo "Sending ALRM signal to qmail-send. Scheme send mail queue."

/usr/local/bin/svc -a /raid/var/supervise/qmail-send

;;

queue)

/raid/var/qmail/bin/qmail-qstat

/raid/var/qmail/bin/qmail-qread

;;

reload|hup)

echo "Sending HUP signal to qmail-send. Reload: locals & virtualdomains"

/usr/local/bin/svc -h /raid/var/supervise/qmail-send

;;

pause)

echo "Pausing qmail-send"

/usr/local/bin/svc -p /raid/var/supervise/qmail-send

echo "Pausing qmail-smtpd"

/usr/local/bin/svc -p /raid/var/supervise/qmail-smtpd

echo "Pausing qmail-pop3d"

/usr/local/bin/svc -p /raid/var/supervise/qmail-pop3d

;;

cont)

echo "Continuing qmail-send"

/usr/local/bin/svc -c /raid/var/supervise/qmail-send

echo "Continuing qmail-smtpd"

/usr/local/bin/svc -c /raid/var/supervise/qmail-smtpd

echo "Continuing qmail-pop3d"

/usr/local/bin/svc -c /raid/var/supervise/qmail-pop3d

;;

restart)

echo "Restarting qmail ......"

echo "+++ Stopping qmail-smtpd."

/usr/local/bin/svc -d /raid/var/supervise/qmail-smtpd

echo "+++ Stopping qmail-pop3d."

/usr/local/bin/svc -d /raid/var/supervise/qmail-pop3d

echo "+++ Sending qmail-send SIGTERM and restarting."

/usr/local/bin/svc -t /raid/var/supervise/qmail-send

echo "+++ Restarting qmail-smtpd."

/usr/local/bin/svc -u /raid/var/supervise/qmail-smtpd

echo "+++ Restarting qmail-pop3d."

/usr/local/bin/svc -u /raid/var/supervise/qmail-pop3d

;;

cdb)

/usr/local/bin/tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp < /etc/tcp.smtp

chmod 644 /etc/tcp.smtp

echo "Reloaded /etc/tcp.smtp."

;;

help)

cat <

stop -- Stopping qmail(smtpd+pop3d)

start -- Starting qmail (smtpd+pop3d)

pause -- temporarily stops mail service(connections accepted, nothing leaves)

cont -- continues paused mail service

stat -- displays status of mail service

cdb -- rebuild the tcpserver cdb file for smtp

restart -- stops and restarts smtp,pop3, sends qmail-send a TERM & restarts it

doqueue -- sends qmail-send ALRM, scheduling queued messages for delivery

reload -- sends qmail-send HUP, rereading locals and virtualdomains

queue -- shows status of qmail queue

alrm -- same as doqueue

HELP

;;

*)

echo "Usage:  $0 {start|stop|restart|doqueue|reload|stat|pause|cont|cdb|queue|help}"

exit 1

;;

esac

exit 0

建立日志目录:

mkdir /raid/var/log: 所有者为qmail:nofiles 权限为755

注:其下的子目录pop3d、qmail、stmpd为mutilog自动构造。

建立进程ID号存放目录:

mkdir /raid/var/pid

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有