5

The manual for GNU tail says

-s, --sleep-interval=N

with -f, sleep for approximately N seconds (default 1.0) between iterations; with inotify and --pid=P, check process P at least once every N seconds

But when I write tail --sleep-interval=10 -F file_name it does not sleep for 10 seconds, it updates it right away. Am I understanding it wrong, or using it wrong?

Thanks for helping

1
  • I would say that the use of "and" in the phrase "with inotify and --pid=P" is that of inclusion in a set rather than the logical intersection of both conditions. In computing terms this phrase would be better written as "with inotify or --pid=P". This clause then applies as you are using inotify because of the -F flag – roaima Oct 23 '20 at 7:58
9

The full manual describes -s as

Change the number of seconds to wait between iterations (the default is 1.0). During one iteration, every specified file is checked to see if it has changed size. When tail uses inotify, this polling-related option is usually ignored. However, if you also specify --pid=p, tail checks whether process p is alive at least every number seconds. The number must be non-negative and can be a floating-point number in either the current or the C locale. See Floating point.

Your system presumably is inotify-capable, so tail will use that instead of polling, and since you’re not following a pid, the -s option has no effect. You can disable inotify with the undocumented ---disable-inotify option (with three dashes), which will result in tail sleeping as expected (thanks to Stéphane Chazelas for the suggestion!).

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.