def stop_hostapd():
	conf = config_gen.get_config()
	env_tups = [(section+'_'+key, val) for section in conf.keys() for key, val in conf[section].items()]
	env_dict = dict(os.environ.items() + env_tups)

	print 'Stopping...'
	for section in config.script_order[::-1]:
		if conf[section].has_key('EXIT_SCRIPT'):
			make_dirs(conf[section])
			print 'Executing %s for [%s]...' % (conf[section]['EXIT_SCRIPT'], section),
			ret = subprocess.call(conf[section]['EXIT_SCRIPT'], env=env_dict)
			if ret == 0:
				print 'Done!'
			else:
				print 'Failed!'
				exit_error('[ERROR] Failed to exit [%s], check log file %s' % (section, conf[section]['LOGFILE']))
dataset/ETHPy150Open nims11/hostapd.py/HPS.py/stop_hostapd/original