Trigger servo output on fence breech

I’m trying to set up a parameter that when a fence is breeched it will trigger a servo output (high or low). My intention is to implement a motor kill switch that will shut down an engine on a mower in the event the fence is breeched. Anyone have any ideas on how this can be done? Possible with a script?
Thanks-