rycher has asked for the wisdom of the Perl Monks concerning the following question:

Ahoy Monks!
I've written an interactive perl/expect program to log in to our Cisco device and do a 'show flows' to a log file on the server.
The 'show flows' is set to run in an infinite 'for' loop to continously capture data.
The trouble I'm having is that the script continues to run and I would have to open another shell to view the output.
I would like to set the loop to somehow run as a daemon process and then break out of the interactive program, back to a shell prompt.
Is this possible? I've tried exit codes, returns, forks, etc.

Thanks in advance!

Replies are listed 'Best First'.
Re: Breaking out of interactive program
by ikegami (Patriarch) on Jan 23, 2010 at 23:25 UTC
      Yea...I thought I could do something simple like that. But it backgrounds the entire program so that the interactive portion (asking for username/pwd) is lost to the user.

        Sorry, I was guessing at what you wanted since I had hard time understanding your question. Based on this new information, I'm sure you'll find Daemon::Daemonize most useful.

Re: Breaking out of interactive program
by JavaFan (Canon) on Jan 23, 2010 at 23:55 UTC
    A solution has been given already, but that's a solution that still has ties to the shell. If you want to have it run detached from the shell, read the section "Complete Dissociation of Child from Parent" in the perlipc manual page.