Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Speak the IP address of your linux machine. Perfect for Raspberry PIs or other headless servers with audio output. Just plug in a speaker or earphones and wait to be told the IP address to ssh to!
Speak the IP address of your linux machine.
Perfect for Raspberry PIs or other headless servers. Just plug in a speaker or earphones and wait to be told the IP address to ssh to!
Requires "espeak" - sudo apt-get install espeak
Make IPspeak.pl executable:
chmod +x IPspeak.pl
Run it automatically at startup (otherwise it's rather pointless, as you'd have to know the IP address to log-in to start it ;) )...
Add to /etc/rc.local (e.g. sudo vi /etc/rc.local ) above the "exit 0", the line:
su - pi -c /home/pi/IPspeak.pl
(note the spaces)
If you want to stop IPspeak (once you've logged in to the IP address it's told you), type:
pkill IPspeak
#!/usr/bin/perl
# IPspeak.pl
# speak the IP address of this machine, e.g. for a Raspberry Pi with no screen.
# requires "espeak" (sudo apt-get install espeak)
# Andy Stanford-Clark (@andysc)
# 18-May-13
# give it a chance to get an IP address at boot-up
sleep 10;
while (1)
{
# look at wireless first, and say that, even if there's also ethernet
$IP = `ifconfig wlan0 | grep 'inet addr'`;
$text = "wireless";
if (!$IP)
{
# if no wireless, look for ethernet
$IP = `ifconfig eth0 | grep 'inet addr'`;
$text = "ethernet";
}
if ($IP =~ /inet addr:(.*?) /)
{
# insert spaces between all characters
@characters = split(//,$1);
$text .= " address " . join(" ",@characters);
# change dots to, um, dots
$text =~ s/\./dot/g;
}
else
{
$text = "no IP address";
}
print "'$text'\n";
system("espeak '$text'");
# wait a minute before doing it again
sleep 60;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.