Ubiquiti sells a nice piece of hardware that is a WAN reboot plug. Unfortunately there is zero configurability in terms of how it determines if WAN is working or not. I haven't been able to find another purpose made piece of kit.
$ cat wifi-off
#! /usr/bin/python2
import parallel,time
p = parallel.Parallel() # open LPT1 or /dev/parport0
p.setData(0xFF)
$ cat wifi-on
#! /usr/bin/python2
import parallel,time
p = parallel.Parallel() # open LPT1 or /dev/parport0
p.setData(0x0)The easiest approach is to just use a commonly available relay modules used with Arduino or similar platforms/microcontrollers, as they already contain minimum or all protection mechanisms. So, the module will contain the reversed diode in parallel with the relay, while additional transistor and optocoupler will allow you a complete galvanic isolation of the controlling- from the and relay circuit.
YouTube has plenty of user-friendly resources with schematics and functional overviews, just search for "relay module" or "relay arduino".
Great overview though, thank you for posting that.