def start_hostapd():
	generate_confs()
	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 'Starting...'
	for section in config.script_order:
		if conf[section].has_key('SCRIPT'):
			make_dirs(conf[section])
			print 'Executing %s for [%s]...' % (conf[section]['SCRIPT'], section),
			ret = subprocess.call(conf[section]['SCRIPT'], env=env_dict)
			if ret == 0:
				print 'Done!'
			else:
				print 'Failed!'
				exit_error('[ERROR] Failed to initiate [%s], check log file %s' % (section, conf[section]['LOGFILE']))
		sleep(1)
dataset/ETHPy150Open nims11/hostapd.py/HPS.py/start_hostapd/original