Advertisement
Guest User

qmail-queue

a guest
Mar 14th, 2012
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.67 KB | None | 0 0
  1. #!/usr/bin/env ruby
  2. include Process
  3.  
  4. tests = $stdin.readlines
  5.  
  6. log= File.open("/var/tmp/test","w")
  7.  
  8. msg_rd,msg_wr = IO.pipe
  9. env_rd,env_wr = IO.pipe
  10.  
  11. @pid = fork
  12.  
  13.    
  14. unless @pid
  15.   $stdin.close
  16.   msg_rd.dup
  17.   msg_rd.close
  18.   msg_wr.close
  19.  
  20.  
  21.  
  22.   $stdout.close
  23.   env_rd.dup
  24.   env_rd.close
  25.   env_wr.close
  26.  
  27.   exec ( '/var/qmail/bin/qmail-queue' )
  28. end
  29.   #msg_rd.close
  30.   #env_rd.close
  31.  
  32.  env_wr.puts 'Fadmin@deeproot.in0Tdsdasddmin@deeproot.in00'
  33.   env_wr.close
  34.  msg_wr.puts "Received by QUBY"
  35.  tests.each  do |test|
  36.     msg_wr.puts test
  37.   end
  38.  
  39.  #log.puts tests
  40.   #log.puts @pid
  41.   #msg_wr.close
  42.   wait(@pid)
  43.   @success= $? >>8
  44.   log.puts @success
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement