How to supply either 5V or 0V without the gradual PSU voltage bleed?
simulate this circuit &ndash; Schematic created using CircuitLab

Figure 1. AC monitoring and shut-off.

Monitor the AC instead. RLY1 will drop out when the AC is switched off. It's contact will open and disconnect the DC output.







simulate this circuit

Figure 2. PSU discharge circuit with no extra power loss during normal operation.