спасибо за направление,по системам не хотят брать,начальство хочет свое и по простому((
# coding: utf-8 import os import socket def main(s): while True: try: client, addr = s.accept() while True: data = client.recv(1024) if data: result = archive_check() client.send(result + "\n") except Exception, ex: print("Some exception!\n", ex) try: print("IP: {ip}".format(ip=addr)) print("Host: {name}".format(name=socket.gethostbyaddr(str(addr)))) except (NameError, socket.error): pass def archive_check(): s2 = os.access("Z:\\TrassirArchive", os.F_OK) if s2: # settings("archive/z")["read_only"] = 0 # timeout(30*1000) # settings("archive/f")["read_only"] = 1 # settings("archive/d")["read_only"] = 1 # timeout(10*1000, archive_check) return "Архив НЕ работает!" else: # settings("archive/f")["read_only"] = 0 # settings("archive/d")["read_only"] = 0 return "Архив работает!" # timeout(10*1000, archive_check) # timeout(0, archive_check) if __name__ == "__main__": s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind(('example.org', 8080)) s.listen(5) main(s)
python monitor.py
telnet example.org 8080