1.  
  2.  
  3. import sys, os, datetime
  4.  
  5. logs = []
  6. plog = open("process.log",'wa')
  7. _pathto = "/media/mountname/"
  8. command = "mv *-log* "
  9.  
  10. def getTime():
  11. todaystring = datetime.datetime.today().strftime("%Y-%m-%d %H:%M:%S")
  12. return "["+todaystring+"] -- "
  13.  
  14.  
  15.  
  16.  
  17. delta = 0
  18. i = hci0
  19.  
  20. while True:
  21. delta+=1
  22. tempDev = os.popen("hcitool -i "+i+" scan --flush")
  23. repl = [e.strip() for e in tempDev.readlines()]
  24. fi = open(i+"-log-"+str(delta)+".txt","w")
  25. for line in repl:
  26. if not("Scanning" in line):
  27. fi.write(getTime() + line.replace(" "," ")+"\n")
  28. fi.close()
  29. tempCp = os.popen(command + _pathto)
  30.  
  31.  
  32.