Changeset 4866
- Timestamp:
- May 23, 2017, 10:19:41 AM (4 years ago)
- Location:
- lliurex-statistics/trunk/fuentes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
lliurex-statistics/trunk/fuentes/debian/changelog
r3623 r4866 1 lliurex-statistics (0.4-7) xenial; urgency=medium 2 3 * Fix race condition that stops sending messages when time changes 4 * Optimize subprocessing calls 5 * Better flavour detection 6 7 -- M.Angel Juan <m.angel.juan@gmail.com> Tue, 23 May 2017 10:17:58 +0200 8 1 9 lliurex-statistics (0.4-6) xenial; urgency=medium 2 10 -
lliurex-statistics/trunk/fuentes/lliurex-statistics.install/usr/sbin/analytics
r3456 r4866 17 17 import lockfile 18 18 import xmlrpclib 19 import time 19 20 20 21 ######### END CONFIG ########### … … 46 47 # 47 48 def sig_handler(sig,frame): 48 global t,LIST 49 global t,LIST,RUNNER 49 50 debug("Aborting...") 51 RUNNER=0 50 52 try: 51 53 # Cancel threads … … 108 110 109 111 def allow_send(): 110 answer = check_server_acknowledge() 111 if answer == '1': 112 debug("allow_send stats by check server acknowledge") 113 return True 114 if answer == '0': 115 debug("deny allow_send stats by check server acknowledge") 116 return False 117 112 global SABOR 113 114 if SABOR.lower() != 'server': 115 answer = check_server_acknowledge() 116 if answer == '1': 117 debug("allow_send stats by check server acknowledge") 118 return True 119 if answer == '0': 120 debug("deny allow_send stats by check server acknowledge") 121 return False 122 118 123 answer = check_local_acknowledge() 119 124 if answer == "yes": … … 172 177 global TIMEOUT 173 178 global BDTIMEOUT 174 175 # Flush in-memory data to file db when expires timeout 176 if ctimeout > TIMEOUT: 179 global RUNNER 180 181 while RUNNER == 1: 182 # Flush in-memory data to file db when expires timeout 183 if ctimeout > TIMEOUT: 177 184 update_db() 178 185 ctimeout=0 179 else:186 else: 180 187 ctimeout+=1 181 188 182 # Call send-data to server when expires dbtimeout183 if btimeout > BDTIMEOUT:189 # Call send-data to server when expires dbtimeout 190 if btimeout > BDTIMEOUT: 184 191 clean_and_send(); 185 192 btimeout=0 186 else:193 else: 187 194 btimeout+=1 188 debug('.',2)189 190 # Reload 1 sec timeout191 t=threading.Timer(1.0,runner)192 # De-comment to allow stop threads inmediately193 # t.daemon = True194 t.start()195 debug('.',2) 196 time.sleep(1.0) 197 # Reload 1 sec timeout 198 #t=threading.Timer(1.0,runner) 199 # De-comment to allow stop threads inmediately 200 # t.daemon = True 201 #t.start() 195 202 #END def runner(): 196 203 … … 263 270 # 264 271 def send_data(): 272 global SABOR 273 global RELEASE 274 265 275 # Calculates mac address 266 276 f = open('/sys/class/net/eth0/address','r'); … … 280 290 except: 281 291 return; 292 282 293 # Get version and flavour 283 p=subprocess.Popen(['lliurex-version','-n'],stdout=subprocess.PIPE) 284 out,err=p.communicate() 285 version=out.strip(); 286 287 p=subprocess.Popen(['lliurex-version','-v'],stdout=subprocess.PIPE) 288 out,err=p.communicate() 289 sabor=out.strip(); 294 #p=subprocess.Popen(['lliurex-version','-n'],stdout=subprocess.PIPE) 295 #out,err=p.communicate() 296 #version=out.strip(); 297 version=RELEASE 298 299 #p=subprocess.Popen(['lliurex-version','-f'],stdout=subprocess.PIPE) 300 #out,err=p.communicate() 301 #sabor=out.strip(); 302 sabor=SABOR 290 303 291 304 # Send json encoded data to server … … 474 487 ctimeout=0 475 488 btimeout=0 489 RUNNER=1 476 490 477 491 # Get configuration parameters … … 507 521 508 522 debug("filename="+filename+' next='+next_filename) 523 524 p=subprocess.Popen(['lliurex-version','-n'],stdout=subprocess.PIPE) 525 RELEASE,err=p.communicate() 526 RELEASE=RELEASE.strip() 527 if RELEASE[0:2] == '15': 528 VERSION_GETTER='lliurex-detect' 529 else: 530 VERSION_GETTER='lliurex-version' 531 532 533 p=subprocess.Popen([VERSION_GETTER,'-f'],stdout=subprocess.PIPE) 534 SABOR,err=p.communicate() 535 SABOR=SABOR.strip() 536 537 debug('Starting on '+SABOR+' '+RELEASE) 509 538 try: 510 539 px= subprocess.Popen(["bash","-c","source /etc/profile && echo $http_proxy"],stdout=subprocess.PIPE) 511 540 proxy=px.stdout.readline().strip() 512 debug('Detected proxy: '+str(proxy)) 541 if str(proxy) != '': 542 debug('Detected proxy: '+str(proxy)) 513 543 except Exception as e: 514 544 debug('Error getting proxy '+str(e))
Note: See TracChangeset
for help on using the changeset viewer.