feat(脚本): 查寻ip变动并发送邮件

pull/534/merge
mack-a 2021-04-04 12:42:11 +08:00
parent 4d40b293d8
commit e544d2d41a
1 changed files with 12 additions and 0 deletions

View File

@ -0,0 +1,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