美文网首页
定时发送邮件

定时发送邮件

作者: watson168 | 来源:发表于2018-08-03 00:28 被阅读60次

    描述:每五天发送一封邮件
    1.写定时脚本
    2.发送邮件
    1.定时脚本

    #!/bin/bash
    last_run_time='1533212401'
    dat=`date +%s`
    last_new=`date -d '10 minutes ago' +%s`
    five_days_secs=`echo "4*24*3600" | bc`
    Today=`date`
    if [[ $((dat - last_run_time)) -lt "${five_days_secs}" ]]; then
        echo "现在是 $Today            Today is a beautiful day" >> /var/log/send-email.log
       /usr/bin/python /home/ansible/wz-temp/remind/send-email.py wz@qq.com   Important  "现在是 $Today            Today is a beautiful day"
       
    else
       sed -i "2c last_run_time='$last_new'" date.sh
        echo "现在是 $Today           Come on boy, you should do     an important thing today"  >> /var/log/send-email.log
       /usr/bin/python /home/ansible/wz-temp/remind/send-email.py  wz@qq.com  Important  " 现在是 $Today           Come on boy, you should do an important thing today"   
    fi
    

    2。1中发邮件脚本见https://www.jianshu.com/p/91c4668b546d

    相关文章

      网友评论

          本文标题:定时发送邮件

          本文链接:https://www.haomeiwen.com/subject/kfmevftx.html