The shell version of See http://my.oschina.net/firxiao/blog/349727
The Project address: https://github.com/Firxiao/check_public_ip
How to use:
git clone https://github.com/Firxiao/check_public_ip.gitcd check_public_ipchmod +x CHECK_PUBLIC_IP.PYCP Conf.ini.example Conf.ini
Change the configuration file
Change the mailbox configuration to the right
VI Conf.ini#url can return your public IP Address[url]url = http://ifconfig.me[mail_server]smtp_server = smtp.example.com Mail_user = Usermail_pass = Passwordmail_postfix = Example.com[user] Mailto_list = ["[Email protected]", "[email protected ]"]
After the configuration is done
./check_public_ip.py
The first execution will record the current public IP address into the public_ip.txt of the current directory and will not send an email alert
Test email can be emptied and executed Public_ip.txt
Can be added to Crontab
*/5 * * * */opt/check_public_ip/check_public_ip.py >/dev/null 2>&1
Public network IP detection (python)