1747980 Members
4527 Online
108756 Solutions
New Discussion юеВ

Redirection Help

 
RajM_1
New Member

Redirection Help

Hello all,

I am running one program it gives me output on the console ( which has my debugging statement on my code ) Like follow

Trying...
Connected to dhn1b203.dev.cingular.net.
Escape character is '^]'.
Connection closed by foreign host.
--- Event --->
--- Event --->
--- Event --->
--- Event --->
--- Event --->
--- Event --->
--- Event --->
--- Event --->
--- Event --->
--- Event --->
--- Event --->
--- BatchEnd --->
[07/12/2005 : 14:22.43.976368174] (3): :: Moving File
--- moveComplete --->
[07/12/2005 : 14:22.43.976368174] (3): :: Move script successful
[07/12/2005 : 14:22.43.976368174] (3): :: Parsing file
[07/12/2005 : 14:22.43.976368174] (3): :: Parse script returned, no files to process

I tried to redirect all this into a file. But i could not

I Tried

/home/raj/bin/>execute nor13cw > raj.txt 2>&1

execute nor13cw is my program

But the output file (raj.txt) only has

Trying...
Connected to dhn1b203.dev.cingular.net.
Escape character is '^]'.
Connection closed by foreign host.

The remaining below stuff is not in the raj.txt

--- Event --->
--- Event --->
--- Event --->
--- Event --->
--- Event --->
--- Event --->
--- Event --->
--- Event --->
--- Event --->
--- Event --->
--- Event --->
--- BatchEnd --->


I can not redirect the debugging statements on the cosole to a file ? :(

Thanks in advance,
-raj..
11 REPLIES 11
Sanjay_6
Honored Contributor

Re: Redirection Help

James R. Ferguson
Acclaimed Contributor

Re: Redirection Help

Hi Raj:

# ./yourscript > logfile 2>&1

Regards!

See the man pages for 'sh-posix'.

...JRF...

RajM_1
New Member

Re: Redirection Help

Thanks JRF.

Sanjay can you please give me the solution rather than telling something. I am new to posting, sorry if reposting matters.
Mel Burslan
Honored Contributor

Re: Redirection Help

Raj,

when you are talking about "console" are referring to the terminal window on your workstation or the actual, physical console of the server ? Because, if it is the server console, the Event lines you see, may be fed by a the syslogd and does not belong to neither the STDOUT nor the STDERR devices, in which case, not being able to capture them by redirection, would not be surprising. Otherwise, i.e., if this is a regular terminal session giving you this trouble, executing the command like James described in his post above, should take care of the problem.

Hope this helps
________________________________
UNIX because I majored in cryptology...
RajM_1
New Member

Re: Redirection Help

Thanks to you mel .Sorry ... the "console" i was referring to the terminal window .

I tried james idea i could not figure out the solution yet.
Mel Burslan
Honored Contributor

Re: Redirection Help

is this nor13cw a script or a compiled c code or something like that ? If it is a script, it would be beneficial if you can attach that one to a message here. Otherwise, you need to tell us what this program is doing in general as the lines saying

--- Event --->
--- BatchEnd --->
[07/12/2005 : 14:22.43.976368174] (3): :: Moving File
--- moveComplete --->
[07/12/2005 : 14:22.43.976368174] (3): :: Move script successful
[07/12/2005 : 14:22.43.976368174] (3): :: Parsing file
[07/12/2005 : 14:22.43.976368174] (3): :: Parse script returned, no files to process

is not of much help to figure it out.
________________________________
UNIX because I majored in cryptology...
RajM_1
New Member

Re: Redirection Help

Hey Mel, You are almost right nor13cw is a C code with calls some proprietry script.
I have a debugging statements in the script. I have debugging stmts just to understand the flow of the system.
You see this below ? Those are all the debug statements in the program.

--Event--->
--- BatchEnd --->
[07/12/2005 : 14:22.43.976368174] (3): :: Moving File
--- moveComplete --->

When i run "execute nor13cw" from the command prompt, it start executing the c & the scripts, started executing my code where i have my debug statements. I want to redirect these into a file so i can see what is the flow of the code etc.,

But i could not able to capture those logs. Its keep running on the terminal. so its hard for me to see what is going on there. Tried to redirect using like "home/raj/bin/>execute nor13cw > raj.txt 2>&1" .. but still i am not ableto capture the logs.

Please let know if you need any information. I am also trying some other things. If i come across the solution i will post
Mel Burslan
Honored Contributor

Re: Redirection Help

Raj,

Looks like the scripts which are called from this compiled program are generating the output that you are unable to capture, hence stuff you see are not actually the STDOUT of the nor13cw, hence no chance to capture.

best way I can suggest is to start a screen capture session before you run it and when finished, exit the screen capture session and use typescript file as your log as follows

# script; /home/raj/bin/nor13cw ; exit
your log and some more is in typescript file in the current directory.

Hope this helps (a little)
________________________________
UNIX because I majored in cryptology...
Muthukumar_5
Honored Contributor

Re: Redirection Help

Try as,

# ./yourscript | tee -a test.log 2>>test.log

or

# script
# ./yourscript
# exit

will capture all execution and results of yourscript. Revert if it is not working.

-Muthu
Easy to suggest when don't know about the problem!