Mailinglist Archive: opensuse-factory (826 mails)

< Previous Next >
Re: [opensuse-factory] Re: Missing tailf in Tumbleweed
On 10/24/2017 09:12 AM, Andreas Schwab wrote:
On Okt 24 2017, "Carlos E. R." <robin.listas@xxxxxxxxxxxxxx> wrote:

I started using tailf many years ago because some documentation said
that "tail -f" caused hard disk activity even when there was nothing new
to display, and "tailf" did not.

Has this changed?

coreutils' tail now uses inotify when possible.

more info:
"when possible" means when the file system type supports it,
currently this is:

$ wget -q -O -
http://git.savannah.gnu.org/cgit/coreutils.git/plain/src/stat.c \
| grep ' case S_MAGIC.* local' \
| sed 's/^.*MAGIC_//;s/:.*$/ /' \
| tr -d '\n'
AAFS ADFS AFFS ANON_INODE_FS AUTOFS BALLOON_KVM BEFS BDEVFS BFS BPF_FS BINFMTFS
BTRFS BTRFS_TEST CGROUP CGROUP2 COH
CONFIGFS CRAMFS CRAMFS_WEND DAXFS DEBUGFS DEVFS DEVPTS ECRYPTFS EFIVARFS EFS
EXOFS EXT EXT2 EXT2_OLD F2FS FAT FUTEXFS
HFS HFS_PLUS HFS_X HOSTFS HPFS HUGETLBFS MTD_INODE_FS INOTIFYFS ISOFS
ISOFS_R_WIN ISOFS_WIN JFFS JFFS2 JFS LOGFS M1FS
MINIX MINIX_30 MINIX_V2 MINIX_V2_30 MINIX_V3 MQUEUE MSDOS NILFS NSFS NTFS
OPENPROM PROC PSTOREFS QNX4 QNX6 RAMFS
RDTGROUP REISERFS ROMFS RPC_PIPEFS SECURITYFS SELINUX SMACK SOCKFS SQUASHFS
SYSFS SYSV2 SYSV4 TMPFS TRACEFS UBIFS UDF
UFS UFS_BYTESWAPPED USBDEVFS V9FS VZFS WSLFS XENFS XENIX XFS XIAFS ZFS ZSMALLOC

(EXT2 includes EXT3/4, as these do not have a different MAGIC number.)

The ones not supporting inotify (reliably) are (change 'local' to
'remote' in the above pattern):

ACFS AFS AUFS CEPH CIFS CODA FHGFS FUSEBLK FUSECTL GFS GPFS IBRIX KAFS LUSTRE
NCP NFS NFSD OCFS2 OVERLAYFS PANFS PIPEFS
PRL_FS SMB SMB2 SNFS VMHGFS VXFS

In the case of an FS for which tail is not using inotify, you could
still instruct it to be nicer to the disk by increasing the interval
to check for changes:

-s, --sleep-interval=N with -f, sleep for approximately N seconds
(default 1.0) between iterations;


OT: usually, the user probably wants 'tail -F' rather 'tail -f';
from 'tail --help':

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 really 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.

... and of course in the docs, e.g.
https://www.gnu.org/software/coreutils/tail

Have a nice day,
Berny
--
To unsubscribe, e-mail: opensuse-factory+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse-factory+owner@xxxxxxxxxxxx

< Previous Next >
Follow Ups