发送前一天的监控日志#!/bin/bash source /etc/profile time=`date -d ‘-1 day‘ "+%Y%m%d"` #判断服务是否已经启动 ser=`/usr/bin/pgrep sendmail` if [ "$ser" != "" ] then echo "the service is running" else /etc/init.d/sendmail start fi #要发送的文件 file=/home/wlycle_uniq/data/send_head_data$time.info #收件人 array=(ex-[email protected] [email protected]) for i in ${array[@]};do mail -s "玉衡短信发送内容定时跟踪" $i -r [email protected] < $file if [ $? != 0 ]; then echo "step for mail is failed" exit 0 fi done
时间: 2024-11-12 15:20:35