Add dead man's switch.

Add failure_max parameter, after which script will no longer cycle
power.