admin scripts
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
759 B

  1. #!/usr/bin/python
  2. import string, os, sys
  3. import subprocess
  4. def getCourses(db):
  5. result = ''
  6. p = subprocess.Popen('./rbsearch -uid '+str(db)+' | grep yearsPaid', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
  7. p.daemon=True
  8. for line in p.stdout.readlines():
  9. result += line
  10. retval = p.wait()
  11. if '1' in result:
  12. return False
  13. else:
  14. return True
  15. #start processing input
  16. filenameGiven = True
  17. try:
  18. filename = sys.argv[1]
  19. except IndexError,e:
  20. print 'Usage: not_a_user_db.py <filename>'
  21. filenameGiven = False
  22. #check if filename of input has been given
  23. if(filenameGiven):
  24. f = open(filename)
  25. lines = [line.strip() for line in open(filename)]
  26. f.close()
  27. for l in lines:
  28. if(getCourses(l)):
  29. print l