Linux ip-10-10-64-122 4.1.7-15.23.amzn1.x86_64 #1 SMP Mon Sep 14
23:20:33 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
I'm using tail -F
in a bash script which in turn loops over the results. This script is supposed to run indefinitely
tail -F /tmp/my.log |
grep --line-buffered "xyz" |
while read i
do
echo "$i"
done
echo "end of read"
however while sometimes it works through a logrotate, other times it does not:
tail: '/tmp/my.log' has become inaccessible: No such file or directory
In this case I do not see "end of read" meaning the tail/while is still running/stuck. I can confirm the log file does get put back in place after logrotate within milliseconds as you would expect.
Logrotate config:
/tmp/mosquitto.log {
rotate 500
compress
maxsize 40M
nocreate
missingok
postrotate
/usr/bin/killall -HUP mosquitto
endscript
}
How can I force this to continue to tail?