Semiconductor based switching with a different power source?
I am trying to make a USB based power outage detector for my computer that can help me in safely shutting down my computer automatically when I am not there to manually shut it down. A male-female USB extension cable of a very short length can be stripped and the red wire (+ve) can be split and connected to an electronically controlled switch which will remain closed as long as it receives current from an external power source say a wall adapter. As soon as the power fails, the switch is opened. A simple USB device like a flash-drive can then be connected to the female end of the cable and the male end of the cable to the computer. A simple C program will check at specific time intervals if the flash drive is accessible. As long as there is power, the program will be able to access the flash drive. As soon as there is a power failure, the program will no longer be able to access the flash drive and start the shut down process.
Do have any suggestions?