- Timestamp:
- Nov 29, 2016, 2:16:32 PM (4 years ago)
- Location:
- lliurex-statistics/trunk/fuentes/lliurex-statistics.install
- Files:
-
- 4 added
- 1 deleted
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lliurex-statistics/trunk/fuentes/lliurex-statistics.install/usr/sbin/analytics
r2773 r2948 16 16 import daemon 17 17 import lockfile 18 import xmlrpclib 18 19 19 20 ######### END CONFIG ########### … … 75 76 LIST.clear() 76 77 # Check if permission flag is granted 77 #if allow_send(): # DEPRECATED: commented, acceptation not needed78 # Send data to master server79 send_data()78 if allow_send(): 79 # Send data to master server 80 send_data() 80 81 # Get new temporary filename 81 82 next_filename=get_filename(LOGPATH) … … 86 87 #END def change_file(): 87 88 88 #DEPRECATED FUNCTION: acceptation not needed now 89 #def allow_send(): 90 # try: 91 # if os.path.isfile('/var/tmp/stats/do_stats'): 92 # return True 93 # else: 94 # return False 95 # except Exception as e: 96 # return False 89 def check_server_acknowledge(): 90 c = xmlrpclib.ServerProxy("https://server:9779/") 91 return c.get_variable("","VariablesManager","STATS_ENABLED") 92 #END def check_server_acknowledge() 93 94 def check_local_acknowledge(): 95 answer = None 96 if os.path.isfile('/etc/lliurex-analytics/status'): 97 fp = open('/etc/lliurex-analytics/status','r') 98 answer = fp.readline(); 99 fp.close() 100 return answer.strip() 101 102 #END check_local_acknowledge 103 104 def allow_send(): 105 answer = check_server_acknowledge() 106 if answer != '1': 107 answer = check_local_acknowledge() 108 try: 109 if answer == "yes": 110 return True 111 else: 112 return False 113 except Exception as e: 114 return False 115 else: 116 return True 117 #END def allow_send() 118 97 119 # 98 120 # Sends data to server and clear all … … 104 126 # clear in-memory list 105 127 LIST.clear() 106 # if allow_send(): # DEPRECATED: commented, acceptation not needed 107 # Send data to master server108 send_data()128 if allow_send(): 129 # Send data to master server 130 send_data() 109 131 # Clear database file 110 132 clear_db()
Note: See TracChangeset
for help on using the changeset viewer.