Advertisement
Hadlock

Untitled

Apr 30th, 2011
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.76 KB | None | 0 0
  1. require 'net/http'
  2.  
  3.  
  4.  
  5. def check_file_for_things filename, url
  6.     begin
  7.     File.open(filename,"r+") do |f|
  8.         output = ""
  9.         f.each do |line|
  10.             puts "parsing line #{line}"
  11. #if !anything       if line =~/\s!.*\w/
  12.             if line =\s!command
  13.                 puts "line #{line} found and removed calling #{url}"
  14.                 html = Net::HTTP.get(URI.parse(url))
  15.             else
  16.                 output << line
  17.             end
  18.         end
  19.         f.pos = 0                    
  20.         f.print output
  21.         f.truncate(f.pos)  
  22.     end
  23.  
  24.     rescue => e
  25.         puts "something had gone wrong: #{e}"
  26.     end
  27. end
  28.  
  29. filename = 'c:\steamlogs\Battlefield Goons.txt'
  30. url = 'http://bfgoons.com/command.php'
  31.  
  32. while (true)
  33.     puts "checking file #{filename} for things"
  34.     check_file_for_things filename, url
  35.     puts "sleepin..."
  36.     sleep(1)
  37.     puts "i'm awake"
  38. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement