Hunter0x7c7
2022-08-11 708e016886e8733afb2d42ddbbf0b20c22463b31
1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/env bash
touch /var/local/mail.log
 
currentIP=$(curl -s -4 whatismyip.akamai.com)
historyIP=$(cat /var/local/mail.log)
if [[ ${currentIP} = ${historyIP} ]];then
    echo '不发送邮件'
    echo '不发送邮件' >> /tmp/mail.log
    exit
fi
echo ${currentIP}|mail -s ${currentIP} xxx@163.com
echo ${currentIP} > /var/local/mail.log