mechanize python XE #22
def aserver():
gw = os.popen("ip -4 route show default").read().split()
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect((gw[2], 0))
ipaddr = s.getsockname()[0]
print Y+"Starting Server\033[0m..."
os.system("service apache2 start")
br = raw_input(G+"Browser: \033[0m")
a = '{0} {1}'.format(br,ipaddr)
os.system(a)
stop = raw_input("hit enter to stop server: ")
print Y+"Stopping Server\033[0m..."
os.system("service apache2 stop")
#-----------------#
#APACHE SERVER END#
#RUN A FILE START#
#----------------#