arturmnt

ARQUIVOSABERTOS

Jun 9th, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. #!/usr/bin/env ruby
  2.  
  3. CAMINHO='/var/spool/asterisk/monitor/256900001/INTERNO/'
  4.  
  5. Dir.glob("*.wav",base:"#{CAMINHO}") do |filename|
  6.  
  7. arquivoAbertoUsandoBackticks = `lsof -c asterisk |grep wav |grep -v format |sort |awk -F '/' '{print $8}' |grep #{filename} 2>&1`
  8.  
  9. puts "\n Arquivo sendo copiado: #{filename}"
  10. puts " Arquivo backticks : #{arquivoAbertoUsandoBackticks}"
  11.  
  12. puts filename.equal?(arquivoAbertoUsandoBackticks)
  13.  
  14. if filename == arquivoAbertoUsandoBackticks
  15. puts "O arquivo #{filename} esta aberto, nada a fazer\n"
  16. else
  17. puts "O arquivo #{filename} nao esta em execucao, pode copiar\n"
  18. end
  19. end
Add Comment
Please, Sign In to add comment