如何在linux下将本机ip发送到指定邮箱?


Table of Contents

Headnotes

Many equations and formulas look intimidating. However, when you hunt them down, they are definitely not! Just papertigers!

Now let's hunt the papertiger.
NOW_IP=`/sbin/ifconfig ppp0 |grep inet|awk {'print $2'}|cut -f2 -d:`
 echo $NOW_IP|mail -s "IP" your@emailaddress

如果是ADSL拨号,将以上命令加入/etc/ppp/ip-up.local文件末尾,让每次拨号后执行以上命令。

#vi /etc/ppp/ip-up.local

也可定时执行,将最上方脚本添加进计划任务conrtab中,具体设置参见CentOS定时将路由器的外网IP发送到指定电子邮箱中


Footnotes

There are many excellent tutorials out there. Some tutorials are too intuitive and it's helpful, but you cannot get it straight on the math details. Some focused on dymestifying math. Some focused on code. I found the best tutorials that give you the conceptual ideas and are possible for implementation without being blind to the math details. Drop a comment if I failed. It would be really appreciable.


If you want to cite this article, please cite this article as:

Lachlan Chen, "如何在linux下将本机ip发送到指定邮箱?," in EarnFromScratch, June 30, 2014, https://www.earnfs.com/en/html/1145.htm.

or

@misc{lachlanchen2020tutorial,
title=如何在linux下将本机ip发送到指定邮箱?,
author={Chen, Lachlan},
year=June 30, 2014
}


EarnFromScratch (September 27, 2020) 如何在linux下将本机ip发送到指定邮箱?. Retrieved from https://www.earnfs.com/en/html/1145.htm.
"如何在linux下将本机ip发送到指定邮箱?." EarnFromScratch - September 27, 2020, https://www.earnfs.com/en/html/1145.htm
EarnFromScratch June 30, 2014 如何在linux下将本机ip发送到指定邮箱?., viewed September 27, 2020,<https://www.earnfs.com/en/html/1145.htm>
EarnFromScratch - 如何在linux下将本机ip发送到指定邮箱?. [Internet]. [Accessed September 27, 2020]. Available from: https://www.earnfs.com/en/html/1145.htm
"如何在linux下将本机ip发送到指定邮箱?." EarnFromScratch - Accessed September 27, 2020. https://www.earnfs.com/en/html/1145.htm
"如何在linux下将本机ip发送到指定邮箱?." EarnFromScratch [Online]. Available: https://www.earnfs.com/en/html/1145.htm. [Accessed: September 27, 2020]


Leave a Reply