Changeset 5395
- Timestamp:
- Jun 29, 2017, 12:36:00 PM (4 years ago)
- Location:
- lliurex-zero-shutdown-client/trunk/fuentes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
lliurex-zero-shutdown-client/trunk/fuentes/debian/control
r498 r5395 9 9 Package: lliurex-zero-shutdown-client 10 10 Architecture: all 11 Depends: ${misc:Depends} 11 Depends: ${misc:Depends}, n4d (>= 0.112) 12 12 Description: LliureX Shutdowner 13 13 - We can shutdown all pc's in local network -
lliurex-zero-shutdown-client/trunk/fuentes/lliurex-zero-shutdown-client.install-files/usr/share/n4d/python-plugins/ShutdownerClient.py
r4699 r5395 5 5 6 6 class ShutdownerClient: 7 7 8 cronfile="/etc/cron.d/lliurexshutdown" 8 9 lliurexshutdown="/usr/bin/lliurexshutdown" 10 9 11 def __init__(self): 12 10 13 pass 14 11 15 #def init 12 16 17 def startup(self,options): 18 19 self.shutdowner_var=objects["VariablesManager"].get_variable("SHUTDOWNER") 20 self.server_trigger(self.shutdowner_var) 21 22 objects["VariablesManager"].register_trigger("SHUTDOWNER","ShutdownerClient",self.server_trigger) 23 24 #def startup 25 26 def server_trigger(self,value): 27 28 if value["cron_enabled"]: 29 if value["cron_content"]!=None: 30 f=open(ShutdownerClient.cronfile,"w") 31 f.write(value["cron_content"]) 32 f.close() 33 else: 34 os.remove(ShutdownerClient.cronfile) 35 36 if value["shutdown_signal"] > self.shutdowner_var["shutdown_signal"]: 37 self.shutdown() 38 39 #def server_trigger 40 41 13 42 def shutdown_cron(self,min,hour,monthday,month,weekday,aux_cronfile=cronfile): 43 14 44 try: 15 45 os.system('echo "%s %s %s %s %s root %s >> /var/log/syslog" > %s' %(min,hour,monthday,month,weekday,self.lliurexshutdown,aux_cronfile)) … … 21 51 22 52 return [False,str(e)] 53 23 54 #def shutdown_cron 24 55 25 56 def noshutdown_cron(self,aux_cronfile=cronfile): 57 26 58 try: 27 59 COMMENT_END = "No lliurexshutdown file configured." … … 34 66 35 67 return [False,str(e)] 68 36 69 #def noshutdown_cron 37 70 38 71 def shutdown(self): 72 39 73 os.system('shutdown -h now') 74 40 75 #def shutdownlist
Note: See TracChangeset
for help on using the changeset viewer.