How about this at the top of the script (in tried yet)
$0 2>$1 |tee $logfile &
Rediredt all script output and tee in background. Exit status should still stop
the build and out put should be on screen as well as in the log file
Sent from Samsung tabletGeoff McLane <ubu...@geoffair.info> wrote:On Sun,
2012-01-01 at 16:40 +0100, Clément de l'Hamaide wrote:
> Hi Pete, Geoff,
>
> Now my script work perfectly.
>
Hi Clément,
Glad to hear it is all now working fine...
Sorry my explanation was not clear...
1. I assume, like Francesco's script, and mine,
you have the command in the early part of the
script, like -
set -e
This command asks the script to EXIT, stop, when the
last process returns other than 0 as a return value...
Without this the default action of a script
is to continue even when the last process gives an
error exit... non zero...
So if you do not do this set -e, or do not want this,
then forget this...
2. Also as I understand it, the script can ONLY react
to the LAST process in a chain of commands...
So if you have a chain of commands like
cmake ... 2>$1 | tee -a $LOGFILE
then the LAST command in this process is the 'tee'
So even if there is a cmake error exit, then the
script will continue, since the last action, the tee,
does not return an error...
Is that clearer?
3. Now the situation is DIFFERENT with a simple
redirection like -
cmake .... 2>&1 >>$LOGFILE
or
make ... 2>&1 >>$LOGFILE
In this case the script will STOP on an error, since
redirection is established BEFORE starting cmake or make,
command, so in this case the LAST command is the cmake or
make error...
But in doing this, as you point out, there is NO OUTPUT
to the console...
Except as Jari pointed out, you can start the script
as a background process, and use a repeated tail
command to view the end of the LOG in a console...
Or even start the script in a terminal, and open
another terminal to do the tail command, repeatedly...
This is what I tend to do, since I too redirect the
SVN or git actions to a log file, and use tail in
another terminal to 'see' what is happening... especially
when it seems to be taking too long ;=()
BUT yes, I too LOVE the fact that 2>&1 | tee -a $LOGFILE
sends ALL cmake or make output to BOTH the LOG
file for later review, AND to the console...
So it is a compromise ;=((
You can either have ALL output put to the LOG file,
AND to the console, BUT then the script will NOT
stop on an ERROR...
Or you can remove this and the script will STOP on
an error... but there is LESS information to the
console if you use a redirection to a log...
So you must choose what ever you think best...
That is all... and I attach a simple example below...
Re: Building terragear-cs with
"-DNO_OPENSCENEGRAPH_INTERFACE=1"
I am not sure if this is the SAME as -D SIMGEAR_HEADLESS=ON
but I am sure they are, in some ways at least, very
'similar'...
Maybe others who know more about this can
comment further, to clarify...
I have only ever used "-DNO_OPENSCENEGRAPH_INTERFACE=1"...
which I know works fine to keep OSG dependency out of the
terragear-cs tools...
Regards,
Geoff.
Example: testexit1
#!/bin/sh
BN=`basename $0`
LOGFILE="/tmp/templog.txt"
echo "$BN: Testing error exit conditions..." | tee -a $LOGFILE
make -f nofileexists
echo "$BN: 1: Last exit was $?, but the script is continuing..."
# set it to stop on error
set -e
make -f nofileexists 2>&1 | tee -a $LOGFILE
echo "$BN: 2: Now last exit is zero $?, so the script is continuing..."
make -f nofileexists 2>&1 >> $LOGFILE
echo "$BN: 3: Since the redirection is set up BEFORE"
echo "$BN: running make then this output will NOT be seen as the "
echo "$BN: script will have exited due to the 'make' error."
PS: And remember to try the very LATEST terragear-cs tools
in development you need to clone and switch to the
'newconstruct' branch...
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual
desktops for less than the cost of PCs and save 60% on VDI infrastructure
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual
desktops for less than the cost of PCs and save 60% on VDI infrastructure
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel