Just replace 192.168.0.3 or 192.168.0 with the ip numbers from your mythtv backend.
#!/usr/bin/env pythonI know that it is possible to use only shell script without python to do that, but I do not master shell script so feel free to modify it to use only shell.
# coding: utf-8
import commands
import sys
res = commands.getoutput('netstat | grep ESTABLISHED | grep -v -e .*192.168.0.3.*192.168.0.3.* -e .*192.168.0.3.*192.168.0.:microsoft-ds.*')
if len(res) > 10:
sys.exit(1)
sys.exit(0)
Use this script as the command to launch before shutting down mythtv backend to verify that it can really shutdown.