#发送邮件函数
function send_mail(){ #定义邮件发送列表 maillist=( [email protected] [email protected] [email protected] ) if [ "$1" == "gateway" ];then for mail in ${maillist[*]};do echo "无法ping通网关,请检查网络" | mail -s "PI(10.78.1.122)网络故障" $mail done elif [ "$1" == "change" ];then for mail in ${maillist[*]};do mail -s "$VIP发生切换" $mail < /tmp/VIP_qiehuan.txt done fi }
注:$1为函数的参数,不是脚本的参数
原文地址:http://blog.51cto.com/liuzhengwei521/2083282
时间: 2024-10-12 21:24:58