Make your OpenWrt router automatically enable your home server and notify you

2011-04-14 22:45:23 GMT

Here's the situation: I have a Mini-ITX home server in my LAN that sometimes gets disabled when the power goes down. I could setup its BIOS to get automatically enabled when it gets power but considering the nature of power outages it may happen that the power goes out and on in rapid succession over a short amount of time which isn't really good for the hardware.

I'd rather choose my server to be checked on a 5 minute basis and have it automatically woken up and I also wanna be notified by email on such an occasion so that I can SSH into it and uncrypt the crypto partition.

I'm about to carry out this task using my OpenWrt driven router. Everything is pretty straightforward, except that I can't send emails through GMail SMTP using Openwrt because mini_sendmail lacks SASL support so I'll just fetch a PHP script that'll actually send the mail.


Be aware that the above wol utility is a home-cooked one.


# m h  dom mon dow   command
0,5,10,15,20,25,30,35,40,45,50,55 * * * * supervise-host mybox

At this ponit restart cron on OpenWrt.

< ?php
mail('', $_GET['host'] . ' has been rebooted', 'uncrypt me!');