spacepaste

  1.  
  2. **********incrontab -e****************
  3. /home/nycnight.com/telecomm/7185695555.WAV/ IN_CLOSE_WRITE /home/prog-shit/sendmail-script.py $#
  4. /home/nycnight.com/telecomm/5166885555.WAV/ IN_CLOSE_WRITE /home/prog-shit/sendmail-script.py $#
  5. /var/spool/asterisk/monitor/ IN_CLOSE_WRITE /home/prog-shit/watch-script2.py $#
  6. *****************script 1*************
  7. #!/usr/bin/env python
  8. import os
  9. path1 = "/var/spool/asterisk/monitor/"
  10. path2 = "/home/nycnightgirls.com/telecomm/"
  11. files = os.listdir(path1)
  12. for file in files:
  13. if file.lower().endswith(".wav"):
  14. phone_number = file[-14:]
  15. output_dir = os.path.join(path2, phone_number)
  16. if not os.path.exists(output_dir):
  17. os.mkdir(output_dir)
  18. os.rename(os.path.join(path1, file),
  19. os.path.join(output_dir, file))
  20. ****************script2****************
  21. #!/usr/bin/python
  22. import smtplib
  23. fromaddr = 'bcddddddd@yahoo.com'
  24. toaddrs = 'nycbbbbbb@gmail.com'
  25. subject = "New call in!"
  26. msg = 'New call in!!!'
  27. username = 'bcddddddd@gmail.com'
  28. password = 'abghujk'
  29. server = smtplib.SMTP('smtp.gmail.com:587')
  30. server.starttls()
  31. server.login(username,password)
  32. server.sendmail(fromaddr, toaddrs,subject, msg)
  33. server.quit()
  34.