#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2011
    Posts
    2
    Rep Power
    0

    Capture all screen i/o and error to a file


    This isn't a simple redirect problem. I need to capture everything that appears on the terminal when a script runs and send it all to a file. This includes output, error, and user input.

    The 'script' command is unsuitable because it forks a shell and when 'script' ends, so do any processes associated with that shell. Sometimes these processes have to continue after 'script' ends and 'script' doesn't allow that.

    The reasons the usual I/O redirects (including tee) won't work are that user input isn't captured and also user prompts that request input never appear. Most of the time (but not always) I am calling a perl script, but it could be a shell script or simply a series of commands.

    I have to remain in whatever shell I'm in when I log in to a system, so a shell-specific script is out - has to be straight Linux commands. I am starting to think that what I need may not be possible to do in the context of the shell, but I thought I'd ask anyway - you never know.

    Thanks for reading all this!
    Last edited by bluecrab22; February 24th, 2011 at 05:12 PM. Reason: Clarification
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jan 2004
    Location
    Constant Limbo
    Posts
    989
    Rep Power
    363
    Using screen you can log everything that happens using "Ctrl-A" "H".
    The nice thing about screen is that you can detach from a running screen session and all processes will remain executing. I'm not sure how that interacts with what is being logged, but with some experimentation you can probably get what you are after.
    True happiness is not getting what you want, it's wanting what you've already got.

    My Blog
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2011
    Posts
    2
    Rep Power
    0
    Originally Posted by L7Sqr
    Using screen you can log everything that happens using "Ctrl-A" "H".
    The nice thing about screen is that you can detach from a running screen session and all processes will remain executing. I'm not sure how that interacts with what is being logged, but with some experimentation you can probably get what you are after.
    Thanks. I'm going to work with 'screen' for a while and see if it is appropriate for what I need.

IMN logo majestic logo threadwatch logo seochat tools logo