View Full Version : GDB --batch >file.log. I need display of output.

March 11th, 2009, 09:45 PM
This is my mini autorestarter for server's core.

echo "run -c test.conf" > test.gdb
echo "bt" >> test.gdb
echo "bt full" >> test.gdb
echo "info thread" >> test.gdb
echo "thread apply all backtrace full" >> test.gdb
until gdb ./core -x test.gdb --batch >test.log 2>test.err
do date && echo "test server died with exit code $?. Restarting..."
grep -B 10 -A 1800 "SIGSEGV" "test.log" > "testtrace.log"
cat "testtrace.log" | ./paster | grep "http" >> "test.link"
cat "test.err" > "testerror.log"
sleep 31;

Issue is, that I need display in console but of course ">test.log 2>test.err" are redirecting it to file.
Is there a way I can multicast output to both terminal & file?

Thanks in advance.

March 11th, 2009, 10:23 PM
With the tee command.

some-command 2>&1 | tee test.log