As far as I've managed to ascertain the two programs in the Ubuntu Repos that deal with wake on lan (wakeonlan and etherwake) don't have any ability to use hostnames rather than IP Addresses to wake over the internet; if you've got an external IP that often changes (as some ISPs provide) then you'll want to use a dynamic DNS service and a hostname.
As such, I've written the following bash script:
Code:
#!/bin/bash
SERVERIP=$(host HOSTNAME | grep -o -P "(:?\d+.?){4}")
wakeonlan -i $SERVERIP HWADDRESS
exit
where HOSTNAME is your hostname and HWADDRESS is the MAC Address of the box you want to wake. You'll also need to forward port 9 on your router so that it will send the wakeonlan signal to the right place (this is the broadcast address for most routers but some may have another method if they don't allow you to forward to the broadcast address).
Hope this is useful