I am working on some development on the plug and got tired of having to look up my router page for my DHCP address. Since I am working with two different networks (home & work) I don't want to give it a static address.
So my trick is for the plug to email me it's ip address upon boot completion.
vi /usr/src/ip.sh or nano /usr/src/ip.sh (I named it ip.sh, you can name it anything you like and put it somewhere else as well)
#!/bin/sh
# Parts copied from Copyright (c) 2010 Sean A.O. Harney
# This script is licensed under GNU GPL version 2.0 or above
email_addr="you@youraddress.com";
subj="PlugPBX_DHCP_Address";
# If you put spaces in the subject, you have to escape them
# or it will print first word only
ifconfig eth0 | \
grep 'inet addr:' | \
awk '{ split($2, ar, ":") ; print ar[2] }'| mail -s $subj $email_addr
exit 0 ;
Paste the code into the window, save it, and close.
chmod 755 /path/to/filename.sh
type '/path/to/filename.sh' to check and make sure it is working.(without the ' marks)
vi /etc/rc.local
go to a line BEFORE exit 0
type /path/to/filename.sh
save & exit.
on each reboot, you will get an email with your ip address.