On 1 April 2013 09:01, Shamit Verma <subs.linux.mum(a)vshamit.com> wrote:
One way to do that is to use a USB Hard disk
enclosures that requires AC
power. Connect this enclosure to mains and add a cheap / spare SATA desktop
With a cron job, a shell script can check presence of this HDD (E.g. lsusb
| grep "device-id-here") every minute. If this HDD is not present, shutdown
can be initiated by the same script.
Similarly, you can attach a cheap / spare router (would cost 400 - 900 Rs)
to AC mains and check reach-ability of this router to determine presence of
power in mains.
Nice and cheap ideas :)