Created
April 11, 2021 08:01
-
-
Save chenshaoju/5a361138d55630d2bcef3581139fb17e to your computer and use it in GitHub Desktop.
Check public ip, if changed then send email by using ssmtp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
LastIP=`cat /root/ip1` | |
WanIP=`curl ifconfig.me` | |
if [ "$LastIP" != "$WanIP" ] | |
then | |
echo "$WanIP" > /root/ip1 | |
echo -e "Subject: this is the subject\n\n$WanIP" | ssmtp [email protected] | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment