No static external IP on Raspberry Pi
My Internet provider doesn't supply me with a static IP address with my broadband, so my Raspberry Pi external web address can wander if my router or connectigets reset. There are third party sites which will provide you with a static URL which follows your wandering IP address but its fun to do it yourself.
To keep me updated on the current IP I wrote a Ruby script which I run via crontab to check and Tweet me is the IP address changes.
You can clone the script at Github https://github.com/alastairhm/myip it uses a Ruby Twitter API library which can be found at https://github.com/sferik/twitter to do the direct message with the new IP.
Full details about getting your Twitter API keys can be found at https://dev.twitter.com/
Doodle's Geek Monkey by Alastair Montgomery
To keep me updated on the current IP I wrote a Ruby script which I run via crontab to check and Tweet me is the IP address changes.
#!/usr/bin/rubyrequire 'open-uri'require 'twitter'twitDM = "twitter_username"remote_ip = open('http://whatismyip.akamai.com').readold_ip = File.open('remote_ip.txt', 'r').readif (remote_ip != old_ip) thenFile.open('remote_ip.txt', "w") { |file| file.write(remote_ip)}client = Twitter::REST::Client.new do |config|config.consumer_key = "xxxx"config.consumer_secret = "xxxx"config.access_token = "xxxx"config.access_token_secret = "xxxx"endclient.update("D #{twitDM} My IP address is now #{remote_ip}")elseputs "IP addresses match"end
You can clone the script at Github https://github.com/alastairhm/myip it uses a Ruby Twitter API library which can be found at https://github.com/sferik/twitter to do the direct message with the new IP.
Full details about getting your Twitter API keys can be found at https://dev.twitter.com/
Doodle's Geek Monkey by Alastair Montgomery