Start and Close Depending to Engine Status
If the "engine" is a typical automotive internal-combustion engine then you can look for an increase in the supply voltage as the alternator is charging the battery. Measure the battery voltage with the engine running, then with the engine stopped. Use a comparator to look for that change, and have the comparator signal your computational unit to shut down, or start up.