Execute a file on read?

E

eddieroger

I am toying around with the concept of dynamic configuration files for
Asterisk (http://www.asterisk.org), and I was wondering if its possible
to have a dynamic file that's executed on read. Basicly, when executed,
the script would output a file that Asterisk is happy with, and
preferably the file could have the extension ".conf", but inside would
be Ruby code. Is this possible, or am I pipe dreaming? Thanks.

Eddie
 
M

Max Afonov

You want Unix fifos (man mkfifo) coupled with a Ruby program that opens
the fifo for writing and dumps config file contents to any 'client'.
I am toying around with the concept of dynamic configuration files for
Asterisk (http://www.asterisk.org), and I was wondering if its possible
to have a dynamic file that's executed on read. Basicly, when executed,
the script would output a file that Asterisk is happy with, and
preferably the file could have the extension ".conf", but inside would
be Ruby code. Is this possible, or am I pipe dreaming? Thanks.

Eddie

************************
MLB.com: Where Baseball is Always On
 
A

Austin Ziegler

I am toying around with the concept of dynamic configuration files for
Asterisk (http://www.asterisk.org), and I was wondering if its possible
to have a dynamic file that's executed on read. Basicly, when executed,
the script would output a file that Asterisk is happy with, and
preferably the file could have the extension ".conf", but inside would
be Ruby code. Is this possible, or am I pipe dreaming? Thanks.

Something like:

File.open("foo.conf", "wb") do |cf|
cf.puts <<-EOS
puts "Hello, Ruby."
EOS
end
load "foo.conf"

?

-austin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top