bash4.2, centos
the script
#!/bin/bash
LOG_FILE=$homedir/logs/result.log
exec 3>&1
exec > >(tee -a ${LOG_FILE}) 2>&1
echo
end_shell_number=10
for script in `seq -f "%02g_*.sh" 0 $end_shell_number`; do
if ! bash $homedir/$script; then
printf 'Script "%s" failed, terminating...\n' "$script" >&2
exit 1
fi
done
It basically runs through sub-shells number 00 to 10 and logs everything to a LOG_FILE
while also displaying on stdout.
I was watching the log getting stacked with tail -F ./logs/result.log
,
and it was working nicely until the log file suddenly got removed.
The sub-shells does nothing related to file descriptors nor the log file. They remotely restart tomcats via ssh
commands.
Question :
tee
was writing on a log file successfully until the file gets erased and logging stops from then on.
Is there a filesize limit or timeout in tee
? Is there any known behavior of tee
that it deletes a file?