Changeset 6017 for n4d-epoptes-client/trunk/fuentes/install-files/usr/share/n4d/python-plugins/EpoptesClient.py
- Timestamp:
- Oct 11, 2017, 6:31:07 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
n4d-epoptes-client/trunk/fuentes/install-files/usr/share/n4d/python-plugins/EpoptesClient.py
r5091 r6017 2 2 import os 3 3 import lliurex.net 4 import threading 4 5 5 6 class EpoptesClient: … … 9 10 if options["controlled"]: 10 11 if options["boot"]: 11 12 if os.system("host server > /dev/null")==0: 13 p=subprocess.Popen(["epoptes-client -c"],shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE) 14 p.communicate() 15 16 devices=lliurex.net.get_devices_info() 17 18 for dev in devices: 19 os.system("ethtool -s %s wol g"%dev["name"]) 12 self.grab_epoptes_certificate_thread() 13 self.disable_wol_thread() 20 14 21 15 #def startup 22 16 17 def grab_epoptes_certificate_thread(self): 18 19 t=threading.Thread(target=self._grab_epoptes_certificate) 20 t.daemon=True 21 t.start() 22 23 #def epoptes_daemon 24 25 def _grab_epoptes_certificate(self): 26 27 if os.system("host server > /dev/null")==0: 28 29 execute=False 30 p=subprocess.Popen(["ps aux | grep 'epoptes -c' | wc -l"],shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE) 31 output=p.communicate() 32 try: 33 t=int(output[0].strip("\n")) 34 if t>1: 35 execute=True 36 except: 37 execute=False 38 39 40 if execute: 41 p=subprocess.Popen(["epoptes-client -c"],shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE) 42 p.communicate() 43 44 #def _grab_epoptes_certificate 45 46 def disable_wol_thread(self): 47 48 t=threading.Thread(target=self._disable_wol) 49 t.daemon=True 50 t.start() 51 52 #def disable_wol_thread 53 54 55 def _disable_wol(self): 56 57 devices=lliurex.net.get_devices_info() 58 for dev in devices: 59 os.system("ethtool -s %s wol g"%dev["name"]) 60 61 #def _disable_wol 62 23 63 #class EpoptesClient 24 64
Note: See TracChangeset
for help on using the changeset viewer.