LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices



Reply
 
Search this Thread
Old 12-08-2005, 11:10 PM   #1
timbuck
LQ Newbie
 
Registered: Dec 2005
Posts: 9

Rep: Reputation: 0
redirect screen output to file


Greetings,
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 ?
 
Old 12-08-2005, 11:37 PM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729
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
 
Old 12-08-2005, 11:51 PM   #3
timbuck
LQ Newbie
 
Registered: Dec 2005
Posts: 9

Original Poster
Rep: Reputation: 0
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.

hehe
 
Old 12-08-2005, 11:59 PM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729
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.
 
Old 12-09-2005, 12:05 AM   #5
timbuck
LQ Newbie
 
Registered: Dec 2005
Posts: 9

Original Poster
Rep: Reputation: 0
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).

Last edited by timbuck; 12-09-2005 at 12:12 AM.
 
Old 12-09-2005, 07:57 PM   #6
timbuck
LQ Newbie
 
Registered: Dec 2005
Posts: 9

Original Poster
Rep: Reputation: 0
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()
screen.passCommand(comandName,ParamString)
screen.stop

ps Im thinking of adding startIn which would be a directory in which to start the process

Last edited by timbuck; 12-09-2005 at 08:02 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to redirect the soundcard output to a file? jr0 Linux - General 2 10-31-2005 07:29 AM
Is there a way in Linux/Unix bash to turn off output or redirect to a file jimwelc Linux - Newbie 6 01-06-2005 04:56 AM
How do I redirect sound card output to file ass0ciate Linux - Software 0 09-14-2004 04:41 PM
How to redirect standard output of piped command to log file andrewstr Linux - General 10 02-04-2004 03:07 PM
output from cpio won't redirect to file rawii Programming 5 01-27-2004 02:49 PM


All times are GMT -5. The time now is 05:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration