#!/bin/bash day=`date +%Y%m%d_%H%M` log_dir=/usr/local/share/zabbix/alertscripts/log name=`echo $1 |awk -F@ ‘{print $1}‘` function redirect_log () { log_file=$log_dir/mail_${day}_$name.log log_err=$log_dir/mail_${day}_$name.err.log mkdir -p $log_dir exec 1>$log_file exec 2>$log_err } # ---------- end of function redirect_log ---------- redirect_log echo "$3" | mailx -s "$2" $1 [ $? -eq 0 ] && echo "mailto:$1 sub:$2 content:$3 Successfull." || echo "mailto:$1 sub:$2 content:$3 Failed."
本文出自 “SQLServer MySQL” 博客,请务必保留此出处http://dwchaoyue.blog.51cto.com/2826417/1969417
原文地址:http://dwchaoyue.blog.51cto.com/2826417/1969417