I'd probably just hang a transistor or FET off one of the GPIO pins and use it to drive a relay. The question is how much software you're willing to write to get it just the way you want it. Raise (go to a non-zero voltage) one of the GPIO pins, connected through a current limiting resistor to the base of a transistor to turn it on, have that pull in a relay. When you turn the Pi off the GPIO voltage will go away automatically so it all turns off. Junk box parts are fine. Turning it on is the only tricky part.
Code: Select all
pig2vcd (1) - A utility to convert pigpio notifications to VCD.
pigpio (3) - A C library to manipulate the Pi's GPIO.
pigpiod (1) - A utility to start the pigpio library as a daemon.
pigpiod_if (3) - A C library to interface to the pigpio daemon.
pigpiod_if2 (3) - A C library to interface to the pigpio daemon.
pigs (1) - command line socket access to the pigpio daemon.
All much fancier than you need, seems like I've seen a way to do it from a script, which you could call from your bashrc file. Fun.