对于运行在UNIX OS上的DOMINO邮件系统,通常都会设置一个启动SHELL脚本来启动DOMINO服务器。下面就是一个AIX OS上的DOMINO服务器启动脚本示例:
# more Start_Server
!/bin/ksh -x
# Domino Server Start Script
# (注释部分省略)
NOTES_USER=notes # AIX userid for this server
NOTES_PATH=/notesdata # Path for server data directory
NOTES_SERVER=mailsrv1 # Name of Domino Server
OUTPUT_LOG=/tmp/$NOTES_SERVER.log # Output file for server console
INPUT_FILE=$NOTES_PATH/$NOTES_USER.input # 主要目的是存放服务器ID文件口令
PATH=$NOTES_PATH:/opt/lotus/bin:$HOME/bin:$PATH
# Script Logic
if ((`id -u` == 0))
then
print "Run the Domino Server as the $NOTES_USER user "
exit
fi
#
# if you are using /etc/hosts for tcpip name resolution rather than a name
# server or NIS, then uncomment the following line:
#export NSORDER=local,bind,nis
#
if [ ! -x /opt/lotus/bin/server ] ; then
echo "Cannot access server command - exiting"
exit 1
fi
if [ ! -d $NOTES_PATH ] ; then
echo "Cannot access notes data directory - exiting"
exit 1
fi
cd $NOTES_PATH
#
# Clean up if the Domino Server terminated abnormally
#
# rm -f ~notes.lck
# mems=`ipcs | grep $NOTES_USER | awk '{ print $1 $2 }' | awk -F"m" '{ print $2 }' | awk '{ print $1 }'`
# sems=`ipcs | grep $NOTES_USER | awk '{ print $1 $2 }' | awk -F"s" '{ print $2 }' | awk '{ print $1 }'`
# for j in $mems;do if [ -n "$j" ] ; then ipcrm -m $j;fi;done
# for j in $sems;do if [ -n "$j" ] ; then ipcrm -s $j;fi;done
#
# Notesbench environment variables
#
# export DEBUGSIGCHILD=1
# export DEBUG_SHOW_TIMEOUT=1
#
# export Notes_SHARED_DPOOLSIZE=230686720
#
# For running debug versions of executables
# export LIBPATH=/lib:/usr/lib:/opt/lotus/notes/latest/ibmpow
#
echo "password" > $INPUT_FILE
#
cp -p $OUTPUT_LOG $OUTPUT_LOG.`date +"%m%d%y_%H%M"`
print "Starting Domino for AIX ($NOTES_SERVER)"
server < $INPUT_FILE > $OUTPUT_LOG 2>&1 &
从上面的脚本示例中,可以看出:Domino服务器在运行期间将其产生的所有输出全部重订向到/tmp/mailsrv1.log文件中,其中包括与Internet的邮件交换简要信息。
接下来,我们来了解SMTP连接的日志记录,参见下面日志记录项。很明显的,只需能够统计出“1 message[s] received”中数据和,也就达到了目的。
2006-08-14 07:13:06 PM SMTP Server: 101.133.109.131 connected
2006-08-14 07:13:06 PM SMTP Server: Message 003D9FE7 received
2006-08-14 07:13:06 PM SMTP Server: 101.133.109.131 disconnected. 1 message[s] received
于是,我们就可以利用awk工具分离出需要的项目,累加即可。下面脚本演示了当日Internet邮件交换总量的统计过程。
!/bin/ksh
strToday=`date +"%y-%m-%d"`
echo $strToday > /tmp/strToday
cat /tmp/mailsrv1.log | grep -f /tmp/strToday | \
grep disconnected | \
awk 'BEGIN {summary=0} {summary += $8} \
END {print "今日的Internet邮件总量:",summary}'