Combine two circuits
simulate this circuit &ndash; Schematic created using CircuitLab

Figure 1. Push to start. Auto power-off.

How it works:


Press SW1 - a momentary push-button with mains voltage rating and a current rating sufficient for your device. The device powers up.
The device provides 5 V supply to the relay coil and the relay contact closes. SW1 can now be released.
On completion of its task the device switches off the 5 V output, the relay is released and power to the device is removed.