This script enables the server to report its ip addresses after change by sending emails.
Configurations are divided into two parts.
First you should check the script runner.py, and set the following variables:
SERVERNAME: the name for your server.EMAIL: the email account you use to send emailsPASSWROD: password of the email account (Notice that if you use 163.com email account, you should use the password for mobile devices instead of the login password)SMTP_SERVER: get this setting from your email service providerSMTP_PORT:
Second, add the emails which you want to be notified when the IP of the server changes to file emails.yaml, which is a yaml setting file.
Use cron to run this script periodically. First clone this project to your local directory. Make the runner.py executable by
chmod -x /path/to/runner.pyThen edit the configuration of cron
crontab -eAdd the following line:
*/5 * * * * /usr/bin/python /path/to/runner.pyRun the following command to make sure the task is reloaded:
sudo service cron reloadThe logs of cron is included in /var/log/syslog. You can list those logo infomation using:
``bash sudo grep CRON /var/log/syslog