For the first part I don't really know but I imagine it can be really simple, perhaps just running a script with cron?
There's a whole section for Wake on Lan in the wiki of both Arch and DD-WRT:
https://wiki.archlinux.org/index.php/Wake_on_lan
http://www.dd-wrt.com/wiki/index.php/WOLAgain a script would probably do the job using the wol package. If you want to put it to sleep automatically when it's idle for a certain amount of time then checking cpu utilisation is easy:
http://www.cyberciti.biz/tips/how-do-i- … ation.html
]]>