PDA

View Full Version : [ubuntu] redirecting to multiple files(actually two files)


jualansandal
August 6th, 2008, 11:10 PM
Hi there,
I would like to ask, how to make a process redirected to multiple files, right now I just want to redirect it into two files.

For Example, I have test.sh file that contains echo "test" , and I want to redirect it into file log1 and log2 at the same time.
How the command should be ?

Thanks

eightmillion
August 6th, 2008, 11:19 PM
If I understand you right, you want to redirect output of a command to multiple files. If that's the case you can use tee. For example,

ps -ax | tee processes.txt | more
outputs ps -ax to processes.txt and the more command.

jualansandal
August 6th, 2008, 11:22 PM
wow, thanks

that was fast.

I will try it

jualansandal
August 6th, 2008, 11:45 PM
--

jualansandal
August 8th, 2008, 12:47 AM
Hi,
there is another problem again,
if I access the second file, the process is stopped and both log file is stopped to be written by the process.

I access it with jsp script and show it automatically for 5 second with javascript in the browser.

Any suggestion ?

thanks

jualansandal
August 10th, 2008, 11:33 PM
I see -i option for ignoring something, will it solve my problem ?

eightmillion
August 10th, 2008, 11:40 PM
Looks promising. You should try it.

jualansandal
August 19th, 2008, 12:05 AM
I tried it, and the result is the same without -i options, any other suggestion/idea

thanks