# Linux tail命令需要注意的问题

tail -f access.log |
do
curl -XPOST -H 'Content-Type: application/json' -d '{"url":"'\$line'"}' http://example.com/api
echo ''
done

With --follow (-f), tail defaults to following the file descriptor,which means that even if a tail’ed file is renamed, tail will continue to track its end. This default behavior is not desirable when you eally want to track the actual name of the file, not the file descriptor (e.g., log rotation). Use --follow=name in that case. That causes tail to track the named file in a way that accommodates renaming, removal and creation.

-F: same as --follow=name --retry
--retry: keep trying to open a file even when it is or becomes inaccessible; useful when following by name, i.e., with --follow=name

Over