FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 03-22-2011, 11:55 AM
"Leo "TheHobbit" Cacciari"
 
Default tee and some commands

Hi chaps

*

Anyone noticed that tee doesn’t seem to log
the output from some commands to a log file?

*

I am using tee in a script on the following
line;

*** ncftpput -u $ftp_user -p $ftp_pass -R
-m -v ftp.mydomain.local / $dest/archives/$1/ | tee -a
$out_file

*

Instead of logging to a log file via tee it
now outputs two copies of the FTP output to the console and
nothing to the log file.

*

Is there a way I can work around that or is
it a limitation in the ncftpput command do you think?

*

Olly



*



Hi,



This could depends from $out_file being equal to "-", then
accordingly to tee documention, the output file is also stdout, thus
achieving a duplication of output.



--
Leo "TheHobbit" Cacciari
Aliae nationes servitutem pati possunt populi romani est propria libertas


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 03-22-2011, 12:00 PM
Tom H
 
Default tee and some commands

On Tue, Mar 22, 2011 at 6:51 AM, Oliver Marshall
<Oliver.Marshall@g2support.com> wrote:
>
> Anyone noticed that tee doesn’t seem to log the output from some commands to
> a log file?
>
> I am using tee in a script on the following line;
>
> *** ncftpput -u $ftp_user -p $ftp_pass -R -m -v ftp.mydomain.local /
> $dest/archives/$1/ | tee -a $out_file
>
> Instead of logging to a log file via tee it now outputs two copies of the
> FTP output to the console and nothing to the log file.
>
> Is there a way I can work around that or is it a limitation in the ncftpput
> command do you think?

What's $out_file and can the user calling tee write to it?

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 03-22-2011, 12:01 PM
"Todd A. Jacobs"
 
Default tee and some commands

On Tue, Mar 22, 2011 at 3:51 AM, Oliver Marshall
<Oliver.Marshall@g2support.com> wrote:
> Is there a way I can work around that or is it a limitation in the ncftpput
> command do you think?

The tee command creates its copies from standard input, but you may be
seeing standard error from the previous commands in the pipeline. A
common fix with tools like tee is just to ensure that both standard
output and standard error from your command both go to the same file
descriptor. Hence:

foo 2>&1 | tee /tmp/bar

will pipe all output through tee, not just standard output. Give it a
try and see if that helps.

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 03-22-2011, 12:29 PM
"Robert P. J. Day"
 
Default tee and some commands

On Tue, 22 Mar 2011, Leo "TheHobbit" Cacciari wrote:

>
> Hi chaps
>
> *
>
> Anyone noticed that tee doesnʼt seem to log the output from some commands to a
> log file?
>
> *
>
> I am using tee in a script on the following line;
>
> *** ncftpput -u $ftp_user -p $ftp_pass -R -m -v ftp.mydomain.local /
> $dest/archives/$1/ | tee -a $out_file

it's entirely possible that what's coming out of the previous
command is being sent to stderr, whereas only stdout is passed
through a pipe by default.

if you want both stdout and stderr to be processed by the pipe, use
the following:

blah blah 2>&1 | going here

the "2>&1" forces stderr to follow stdout, at which point both streams
go to the pipe.

rday

--

================================================== ======================
Robert P. J. Day Waterloo, Ontario, CANADA
http://crashcourse.ca

Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
================================================== ======================--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 

Thread Tools




All times are GMT. The time now is 08:02 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org