tailコマンドはUNIX(みたいな)サーバー管理者であれば、最もよく使うコマンドの一つでしょう。/var/log/messagesや/var/log/maillogに対してtailしたことが何度もあると思います。
ところで、tailをファイルに適用する場合、そのファイルがlogrotate(8)やnewsyslog(8)でローテートされるのもこれまたよくある話です。
そういう場合には-fオプションの代わりに、-Fオプションを使います。
FreeBSD-4.11Rのman 1 tail にはこうあります。
-F The -F option implies the -f option, but tail will also
check to see if the file being followed has been renamed
or rotated. The file is closed and reopened when tail
detects that the filename being read from has a new inode
number. The -F option is ignored if reading from standard
input rather than a file.
RHEL3.0のman 1 tail (coreutils-4.5.3)はもっとシンプルで。
--retry
keep trying to open a file even if it is inaccessible when
tail starts or if it becomes inaccessible later -- useful
only with -f
(中略)
-F same as --follow=name --retry
例えばこんな風に使えば、気になる誰かさんからのメールも端末操作をしてるように装いつつ、すぐに気が付くことができたりします。
% tail -F /var/log/maillog | grep hoge@example.jp Jan 09 12:00:00 mailsrv postfix/qmgr[?????]: ?????????: from=<hoge@example.jp>, size=?????, nrcpt=1 (queue active)