Translating with DrWatson… this can take a few seconds the first time.
This is a genuine, complex translation. DrWatson protects commands, error codes, and log output while naturally translating the surrounding text. It’s translated once and saved.
Ian on HP-UX could not get the output of time around a dbaccess here-document to land in time.log, as it appeared on the terminal. Keith Simmons and Art S. Kagel explained redirect order: redirect stdout first, then 2>&1. Art suggested time ( dbaccess - <<! ... ! ) >> time.log 2>&1. Jonathan Leffler offered separate stdout and stderr files and sqlcmd -B for timing. Solved.
Auto-generated by Claude from the posts below — may be imperfect; read the full thread.
Hi all;
Ya - I know - but I bet the answer is on this list.
I am in HP Unix, not that I think this will influence the answer.
I run something like :-
time ( dbaccess - <<! whatever ! 2>&1 >> log ) 2>&1 >> time.log #
The crt's are there
But the `time` always ends up on the tty and not in the file
'time.log'.
Man `time` says the times are on stderr, but this beats me and the
Platform guys !
Any idea's ?
Regards
Ian
↪ replying to ian
Keith Simmons — — source: Usenet: comp.databases.informix
On 17/08/07, ian <ipellew@yahoo.com> wrote:
> Hi all;
>
> Ya - I know - but I bet the answer is on this list.
>
> I am in HP Unix, not that I think this will influence the answer.
>
> I run something like :-
>
> time ( dbaccess - <<! whatever ! 2>&1 >> log ) 2>&1 >> time.log #
> The crt's are there
>
> But the `time` always ends up on the tty and not in the file
> 'time.log'.
>
> Man `time` says the times are on stderr, but this beats me and the
> Platform guys !
>
> Any idea's ?
>
> Regards
> Ian
>
> _______________________________________________
> Informix-list mailing list
> Informix-list@iiug.org
> http://www.iiug.org/mailman/listinfo/informix-list
>
Ian
I always understood you had to redirect STDOUT before redirecting
STDERR to STDOUT. Try >> time.log 2>&1 at the end.
Keith
↪ replying to ian
Art S. Kagel — — source: Usenet: comp.databases.informix
On Aug 17, 4:01 am, ian <ipel...@yahoo.com> wrote:
> Hi all;
>
> Ya - I know - but I bet the answer is on this list.
>
> I am in HP Unix, not that I think this will influence the answer.
>
> I run something like :-
>
> time ( dbaccess - <<! whatever ! 2>&1 >> log ) 2>&1 >> time.log #
> The crt's are there
>
> But the `time` always ends up on the tty and not in the file
> 'time.log'.
>
> Man `time` says the times are on stderr, but this beats me and the
> Platform guys !
>
> Any idea's ?
>
> Regards
> Ian
Keith is correct. On UNIX if you redirect STDERR to STDOUT then
redirect stdout the effect is:
Send stderr to where stdout is now going then redirect stdout
somewhere else. Also, if you redirect output from the subshell for
dbaccess and also the containing app's stdout/stderr to the same file,
there's a possibility that the output from one could stomp on the
other. Better to just let the inner shell's output flow through the
redirections of the caller.
So that should be:
time ( dbaccess - <<! whatever ! ) >> time.log 2>&1
Art S. Kagel
ian wrote:
> Hi all;
>
> Ya - I know - but I bet the answer is on this list.
>
> I am in HP Unix, not that I think this will influence the answer.
>
> I run something like :-
>
> time ( dbaccess - <<! whatever ! 2>&1 >> log ) 2>&1 >> time.log #
> The crt's are there
>
> But the `time` always ends up on the tty and not in the file
> 'time.log'.
>
> Man `time` says the times are on stderr, but this beats me and the
> Platform guys !
>
> Any idea's ?
The way I'd do it is:
( time dbaccess - <<! whatever ! ) >time.stdout 2>time.stderr
Or I could combine standard output and standard error along the lines
other people suggested.
Note that in a pipeline, you can do:
command1 2>&1 | command2
Now command2 gets to see the standard error (and standard output) of
command1.
And for timing SQL, I'd suggest:
sqlcmd -B <<!
whatever
!
That will give you sub-second timing on each command - at least, elapsed
time.
--
Jonathan Leffler #include <disclaimer.h>
Email: jleffler@earthlink.net, jleffler@us.ibm.com
Guardian of DBD::Informix v2007.0226 -- http://dbi.perl.org/
We use strictly necessary cookies to make this site work. With your
consent we’d also use optional cookies for analytics and marketing. You can accept all,
reject all, or choose. Read our Cookie Policy.