Created
January 28, 2013 22:39
-
-
Save wadouk/4659971 to your computer and use it in GitHub Desktop.
Have your raspberry mail it's IP when you plug the network cable. Put in /etc/network/ip-up.d, and chmod +x of course
This file contains 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 | |
ip=$(ifconfig | grep "inet addr" | grep -v "127") | |
/usr/bin/python << EOF 2>&1 >> /tmp/mailip.log | |
import smtplib | |
from email.mime.text import MIMEText | |
msg = MIMEText(" ") | |
msg['Subject'] = 'Rasp IP %s' % "${ip}" | |
msg['From'] = me | |
msg['To'] = you | |
s = smtplib.SMTP('smtp.known.com') | |
s.sendmail(me, you, msg.as_string()) | |
s.quit() | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment