redirect screen output to file
Take it easy on this Linux Virgin o.O
just had a box setup with Linux today and already have a general question.
I want to use screen to query a console app by passing in a command supported by it and direct the output (or rather the console contents) to a file.
the app Im testing is a quake iii server
screen -r screenNumber -X status for example
or screen -x screenNumber -X status > myDump.txt
Im not quite getting it to work.
mainly it just switches me to that window but dumps nothing to the file even after I ctrlA D
Since I have only about 15 minutes experience its probably a silly question but I relly thought this would be easy.
any tips for me ?
You are on the right track. first, try simple commands in a terminal window, eg
ls -l > dirdump
cat dirdump (You should see your listing)
If your command doesn't write the file, then there is something different about it. i.e. --normally--if a command puts output on the screen, then > filename puts that same output in a file.
Lot's of good tutorials out there----type "redirection in linux" in a Google search, and you'll find lots---I've got a good one from linuxsa.org.au
I think you are correct . There is something different about screen. I dont know whether to laugh or cry. since screen should be the most standard of standard outputs lol,sniffle.
Oh yesssss---I just glanced at the man page. You need to do some serious reading.
Short answer: If you are sitting in a terminal window, and do the screen command, then it seems that you terminal may cease to be stdout. If so, then i have no clue what the redirection operator does.
I guess I wil have to read then. I'm using Securecrt to shell screen but ultimately will automate the shell of screen to query status and send commands to processes. This is fairly easy on windows so I know its gotta be easy on Linux once I figure out how. Thanks for the tips.
ps. Im not trying to get stdout "of" the terminal (on my client).
Well you were right. It looks like Im going to settle for a dynamic logfile path and enable logging and wrap screen with a few functions
screen.start - calls to screens module to start a console app return screen pointer or id
screen.logFile(v) - if started and v undefined readLogFile
if started and v !undefined appendLogFile || writeLogFile - sounds bad but either append or write undecided yet.
if !started and v return setLogFilePath(v)
unless v == false then no log file
if !started and !v return getLogFilePath()
ps Im thinking of adding startIn which would be a directory in which to start the process
|All times are GMT -5. The time now is 06:51 PM.|