I had the same question a few weeks back and gave up on shutting down the mining on Antminers programatically. I also sent a support question to Awesomeminer about it and they replied that for Antminers there isn't a good way to do it, the Antminers firmware/software will very stubbornly keep restarting the mining process.
So I opted for heavy duty smart switches instead. Just got them running this week and just starting to try timing the off/on of my miners. It's working but now I'm finding they don't do well starting up cold - they require a few restarts to get everything hashing/controlling right.