Execute a file on read?

Discussion in 'Ruby' started by eddieroger, Nov 3, 2006.

  1. eddieroger

    eddieroger Guest

    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
    eddieroger, Nov 3, 2006
    #1
    1. Advertising

  2. eddieroger

    Max Afonov Guest

    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'.

    eddieroger wrote:
    > 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
    Max Afonov, Nov 3, 2006
    #2
    1. Advertising

  3. On 11/3/06, eddieroger <> wrote:
    > 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
    --
    Austin Ziegler * * http://www.halostatue.ca/
    * * http://www.halostatue.ca/feed/
    *
    Austin Ziegler, Nov 3, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ma740988

    read file, execute functions

    ma740988, Nov 16, 2008, in forum: C++
    Replies:
    5
    Views:
    311
    ma740988
    Nov 17, 2008
  2. Sreejith K
    Replies:
    24
    Views:
    975
    Sreejith K
    Mar 24, 2009
  3. Replies:
    4
    Views:
    339
    eric dexter
    Jun 28, 2010
  4. Savas Ates
    Replies:
    1
    Views:
    266
    Patrice
    Aug 17, 2004
  5. Alex Dowad
    Replies:
    4
    Views:
    250
    Michel Demazure
    May 1, 2010
Loading...

Share This Page