Detect when a Ruby program exits

Discussion in 'Ruby' started by James Coglan, Jan 9, 2009.

  1. James Coglan

    James Coglan Guest

    [Note: parts of this message were removed to make it a legal post.]

    Hi all,

    Is there a way to have your code notified when a Ruby process is terminated?
    I'm looking for a way to serialize a bunch of in-memory data to disk
    automatically when a Rails app is shut down. I might be better off storing
    it in SQLite but would like to know if the in-memory option is possible
    first.

    Thanks,
    James
    http://github.com/jcoglan
     
    James Coglan, Jan 9, 2009
    #1
    1. Advertising

  2. Your are probably looking for Kernel::at_exit

    blambeau

    On Fri, Jan 9, 2009 at 11:28 AM, James Coglan <> wrote:
    > Hi all,
    >
    > Is there a way to have your code notified when a Ruby process is terminated?
    > I'm looking for a way to serialize a bunch of in-memory data to disk
    > automatically when a Rails app is shut down. I might be better off storing
    > it in SQLite but would like to know if the in-memory option is possible
    > first.
    >
    > Thanks,
    > James
    > http://github.com/jcoglan
    >
     
    LAMBEAU Bernard, Jan 9, 2009
    #2
    1. Advertising

  3. James Coglan

    James Coglan Guest

    [Note: parts of this message were removed to make it a legal post.]

    2009/1/9 LAMBEAU Bernard <>

    > Your are probably looking for Kernel::at_exit




    Fantastic, just what I needed. Thanks!
     
    James Coglan, Jan 9, 2009
    #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. Bob Helber

    system call exits the loop

    Bob Helber, Jan 13, 2004, in forum: Perl
    Replies:
    1
    Views:
    741
    Bob Helber
    Jan 13, 2004
  2. Ning
    Replies:
    4
    Views:
    710
    Dan Pop
    Sep 26, 2003
  3. Ian Wilson
    Replies:
    4
    Views:
    651
    Ian Wilson
    Jan 24, 2007
  4. Replies:
    30
    Views:
    1,497
    niraj
    Jul 3, 2011
  5. Tuxedo
    Replies:
    7
    Views:
    431
    J. Gleixner
    Aug 16, 2012
Loading...

Share This Page