Tee doesn't write all displayed data into text file

"Debain 9 - LXDE"

I execute follow line in the bash terminal:
/ts3/server/ts3server_startscript.sh start createinifile=1 | tee -a /ts3/server/key.txt

The displayed output looks like follow:

My key.txt file looks like follow:

How can i save the whole displayed text in my file?
Why does tee not redirect the whole text?

try:

/ts3/server/ts3server_startscript.sh start createinifile=1  2>&1 | tee -a /ts3/server/key.txt
3 Likes

The complete output gets now written into the key.txt file. Thats good so far. Thank you!

Follow is the complete code block:

       # ts3 Server Starten & config erstellen
        /ts3/server/ts3server_startscript.sh start createinifile=1 2>&1 | tee -a /ts3/server/key.txt
        sleep 3s
        /ts3/server/ts3server_startscript.sh stop
         sleep 3s

But the script hangs now. Follow gets written on the display but after it hangs. (maybe the sleep command ? Edit: tested .... its not the sleep command)

man bash :

1 Like

if you run the 'start' part with or without ...| tee ... does it "hang"?
if you run the 'stop' part, does it "hang"?
The presence of the .. 2>&1 | tee.. shouldn't make the script "hang"...

/ts3/server/ts3server_startscript.sh start createinifile=1 | tee -a /ts3/server/key.txt Doesn't hang.
/ts3/server/ts3server_startscript.sh start createinifile=1 Doesn't hang.
/ts3/server/ts3server_startscript.sh start createinifile=1 2>&1 /ts3/server/key.txt Doesn't hang. (No key.txt file gets createt)
/ts3/server/ts3server_startscript.sh start createinifile=1 2>&1 | tee -a /ts3/server/key.txt Does hang, the script doesn't continue after the output (see last post)

I don't need to create log files for the 'stop' parameter. But i tested it for you. It works fine with the stop parameter:
./ts3server_startscript.sh stop 2>&1 | tee -a ./test.txt

Edit:

This code works. It saves the key in the text. After that shows the key with cat.
It's not the best solution but it works.

/ts3/server/ts3server_startscript.sh start createinifile=1 2> /ts3/server/key.txt
sleep 3
cat /ts3/server/key.txt
 /ts3/server/ts3server_startscript.sh stop

Thank you for the help!