Advertisement
asterolomaster

random voicerecords for QA

Jul 11th, 2018
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.97 KB | None | 0 0
  1. #!/bin/bash
  2. ###GLOBALS###
  3. dbhost='localhost'
  4. table='asteriskcdrdb.cdr'
  5. dbuser='root'
  6. dbpass='place_your_password_from_mysql_here'
  7. dst='place_extension_of_your_queue_or_exten'
  8. tmpdir='/tmp/temprec'
  9. rm $tmpdir/*
  10. mkdir $tmpdir
  11.  
  12. mounth=$(date +%m)
  13. year=$(date +%Y)
  14. for (( day=1; day<32; day++ ))
  15. do
  16.  
  17. nextday=$(($day + 1))
  18.  
  19. if [ "$day" -lt "10" ]
  20. then
  21. aday=0$day
  22. else
  23. aday=$day
  24. fi
  25.  
  26. cd /var/spool/asterisk/monitor/$year/$mounth/$aday/
  27. cp $(
  28.  
  29. start="$year-$mounth-$aday"
  30. stop="$year-$mounth-$nextday"
  31.  
  32. #/usr/bin/mysql -u$dbuser -p$dbpass -h$dbhost  -Bse
  33.  
  34. sql="SELECT recordingfile FROM $table WHERE calldate BETWEEN '$start' AND '$stop' AND dst LIKE '$dst' AND disposition LIKE 'ANSWERED' ORDER BY RAND() LIMIT 2; "
  35.  
  36.  
  37. /usr/bin/mysql -u$dbuser -p$dbpass -h$dbhost -Bse "$sql"
  38.  
  39. ) $tmpdir
  40.  
  41. done
  42.  
  43. zip --password PASSWORD_FOR_THIS_ZIP_ARCHIVE -r -5 $tmpdir/$year-$mounth.zip $tmpdir/*
  44.  
  45. scp $tmpdir/$year-$mounth.zip USER@HOST:/var/www/html/your_shared_folder/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement