The first part of this project is to make a remote power switcher. The switch is released with a Kuman K30. It is an 8-channel-relay controlled by simple logical interface. Each relay needs around 20mA when active. In the worst case the K30 needs around 160mA. This can be supplied by the Raspberry Pi (see Part 1 Schematic). I want to use two channels for one target, one for the 5V and one for the GND.
For the remote control I wrote three shell scripts. The first script is set in PATH on my work station. It calls a ssh and executes the second script on the Raspi.
The second script controls the GPIOs of the Raspi. It is important to note that the relays are active low.
The third script is placed in the rc.local on the Raspi. It initializes the GPIOs, otherwise the pins are in an undefined state.