标签:sources awk res big 检测 The mail -s main sts
# cat check_gitlab_bak.sh
#!/bin/sh
source /etc/profile
# 定义邮件发送列表
maillist=(
zise@feizhu.com
)
# 发送邮件函数
send_mail(){
for mail in ${maillist[*]}; do
echo -e "`date +%Y:%m:%d` backups success, backups big $1, host surplus resources $2 " | mail -s "${Title}" $mail
done
}
# 定义需要检测的备份信息的时间
baklist=(
`ll -t /backups/160* | awk ‘NR==1{print $7}‘`
)
# 检测是否进行备份
for domain in ${baklist[*]};do
echo "当前的时间: " `date`
time=`date +%d`
echo $domain
backups=`ll -th /backups/160* | awk ‘NR==1{print $5}‘`
hoststorage=`df -h | grep -w /dev/vda1 | awk ‘{print $5}‘`
if [ $domain -eq $time ]; then
Title="gitlab bak success"
send_mail $backups $hoststorage $Title
else
Title="gitlab bak failed"
send_mail $backups $hoststorage $Title
fi
done
标签:sources awk res big 检测 The mail -s main sts
原文地址:https://www.cnblogs.com/zisefeizhu/p/14011777.html