文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>为"rsync对Windows客户端进行备份"做日志和Email..

为"rsync对Windows客户端进行备份"做日志和Email..

时间:2007-12-07  来源:blueantelope

#!/bin/sh

 
#########################################

# MailAdmin.sh

# blueantelope

# blueantelope@

# 2007-12-07

# Write on Office

#--------------------------------------------------

# The shell uses send mail to Administrator

# to report Client backup status. It uses bsmtp

# maintly at 17:00 daily.

#--------------------------------------------------

 
# LocalEmail : local mail virutal account, mail from

# AdminEmail : Administrator' account, send to

LocalEmail="[email protected]"
AdminEmail="[email protected]"
 
logdir="/var/log/IncrementDTP/"

# First element in thr array is length of the array
logfile=("5" "user1.log" "user2.log" "user3.log" "user4.log" "user5.log")
#echo $logfile

filecount=`expr ${logfile[0]}`
initcount=1
#echo $filecount

 
while [ $initcount -le $filecount ]
do
        userlogfile=$logdir${logfile[$initcount]}
        if [ -f $userlogfile ]; then
                sed -n '$p' $userlogfile >> /tmp/mailstatus # Filter the log file to obtain stat

us of backup now in the last line
                echo "" >> /tmp/mailstatus
        else
                echo "${logfile[$initcount]} is not exist" >> /tmp/mailstatus
                echo "" >> /tmp/mailstatus
        fi
        initcount=`expr $initcount + 1`
done
 
# -f set the From

# -h smtp server

# -s title

# /tmp/mailstatus : mail content

bsmtp -f $LocalEmail -h mailserver.com -s "Incremnet status for every Clinet from ClientBackup" $AdminEmail
 < /tmp/mailstatus
 
rm -rf /tmp/mailstatus

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载