RPi3 Auto Email New Public IP If Changed (Shell)
Last updated
Last updated
Use wget
to download IP-Reporting script
Give the script executing permission
Enter your gmail address and receiver email address to the script
Enter your gmail password to ssmtp.conf
Note : If your gmail have set Two-Step Verification
, you should follow the step to get token:
Log-in into Gmail with your account
Navigate to https://security.google.com/settings/security/apppasswords
In 'select app' choose 'custom', give it an arbitrary name and press generate
It will give you 16 chars token
Use the token as password with your Gmail account and two factor authentication will not be required.
Move report-ip.sh
to usr folder
Create a systemd service to make the script will auto be run on boot It can auto check the network connection make sure the network is online so that it can send the email
Move report-ip-sh.service
to systemd folder
Enable the service
Start the service
Use systemctl
to check the status of the service
Now edit crontab to make the script run every minutes
Add the following script on the bottom, then save and exit
Restart cron service
Finish