Proyecto

General

Perfil

« Anterior | Siguiente » 

Revisión 56

Añadido por jredrejo hace alrededor de 14 años

Contempla la situación de profesor de guardia

Ver diferencias:

configura_hostapd.py
import socket
import logging
import subprocess
from shutil import copy
LOG_FILENAME= "/var/log/configura-hostapd.log"
fecha=[]
......
logging.getLogger().error("Hay un error el el fichero horario.txt en el servidor de aula")
return ""
else:
copy("/etc/hostapd/hostapd.accept","/etc/hostapd/hostapd.accept.bak")
f=open(destino,"r")
if not os.path.exists("/etc/hostapd"):
try:
......
return ""
else:
g=open("/etc/hostapd/hostapd.accept","w")
esta_en_horario=False
while True:
dato=f.readline()
if not dato:
......
if hora>lin[2] and hora<lin[3]:
g.write(lin[1])
g.write("\n")
esta_en_horario=True
f.close()
g.close()
return g
#si un profesor de guardia hace login, se autorizan automáticamente los
#alumnos que hubiera autorizado el profesor anterior:
if not esta_en_horario:
copy("/etc/hostapd/hostapd.accept.bak","/etc/hostapd/hostapd.accept")
return g
def reinicia_hostapd():
resultado=subprocess.Popen(["invoke-rc.d","hostapd","restart"])

Exportar a: Unified diff