J
jdevito01
Hi All,
I have code that will parse a text file line by line and then send the
variable I want to a sub routine to send pages to people. My question
is can I use threads to parse that text file with out duplicating the
output. Below is the code it may make more sense to look at it.
#!/usr/bin/ruby
trap('SIGHUP','IGNORE')
i = 0
def autopage(pagenum,count)
begin
`snpp -s SERVER ADDRESS -f 'EOC Notify' -m 'test' #{pagenum}`
rescue
puts "#{pagenum} has NOT been paged."
else
puts "#{pagenum} has been paged. #{count} "
end
end
File.open('//var//lib//asterisk//agi-bin//pager_list.txt', 'r') do |
f1|
while line = f1.gets
result = {}
pagenum,fname,lname=line.split(" ")
if line.split.empty?
else
if pagenum == "####"
else
count = (i += 1)
autopage(pagenum,count)
end
end
end
end
Thanks!!
I have code that will parse a text file line by line and then send the
variable I want to a sub routine to send pages to people. My question
is can I use threads to parse that text file with out duplicating the
output. Below is the code it may make more sense to look at it.
#!/usr/bin/ruby
trap('SIGHUP','IGNORE')
i = 0
def autopage(pagenum,count)
begin
`snpp -s SERVER ADDRESS -f 'EOC Notify' -m 'test' #{pagenum}`
rescue
puts "#{pagenum} has NOT been paged."
else
puts "#{pagenum} has been paged. #{count} "
end
end
File.open('//var//lib//asterisk//agi-bin//pager_list.txt', 'r') do |
f1|
while line = f1.gets
result = {}
pagenum,fname,lname=line.split(" ")
if line.split.empty?
else
if pagenum == "####"
else
count = (i += 1)
autopage(pagenum,count)
end
end
end
end
Thanks!!