On 00-12-26 Ethan Benson wrote:
> On Tue, Dec 26, 2000 at 12:26:10PM +0100, Christian Kurz wrote:
> >
> > Well, this is a feature that tail on FreeBSD has. If you start it with
> > -F, it will tail you the current file like our tail -f. But if know the
> > logfile will be rotated, it will notice this and reopen the new current
> > one and tail this one. This is a feature that I really miss in GNU tail.
> in fact GNU tail does have this feature, its just done a bit
> differently:
> tail --follow=name --retry /var/log/messages
> ive been using this for ages without any problems, works quite nicely
> with log rotation, tail just outputs a message saying the file has
> been replaced, and follows the new one.
Well, as I'm a bit lazy in typing always this long option names, I just
wrote a patch to support -F and --follow-forever that do the same. As
the patch is very small, I will just attach it to this mail. (Yes, I
will seperately send it to the BTS.)
Ciao
Christian
--
Debian Developer and Quality Assurance Team Member
1024/26CC7853 31E6 A8CA 68FC 284F 7D16 63EC A9E6 67FF 26CC 7853
Binary files textutils-2.0.old/src/.tail.c.swp and textutils-2.0/src/.tail.c.swp differ
diff -uNr textutils-2.0.old/src/tail.c textutils-2.0/src/tail.c
--- textutils-2.0.old/src/tail.c Thu Aug 5 16:38:02 1999
+++ textutils-2.0/src/tail.c Tue Dec 26 17:33:25 2000
@@ -187,6 +187,7 @@
{"allow-missing", no_argument, NULL, CHAR_MAX + 1},
{"bytes", required_argument, NULL, 'c'},
{"follow", optional_argument, NULL, 'f'},
+ {"follow-forever", optional_argument, NULL, 'F'},
{"lines", required_argument, NULL, 'n'},
{"max-unchanged-stats", required_argument, NULL, CHAR_MAX + 2},
{"max-consecutive-size-changes", required_argument, NULL, CHAR_MAX + 3},
@@ -1311,7 +1312,7 @@
count_lines = 1;
forever = from_start = print_headers = 0;
- while ((c = getopt_long (argc, argv, "c:n:f::qs:v", long_options, NULL))
+ while ((c = getopt_long (argc, argv, "c:n:f:F::qs:v", long_options, NULL))
!= -1)
{
switch (c)
@@ -1357,6 +1358,11 @@
follow_mode = XARGMATCH ("--follow", optarg,
follow_mode_string, follow_mode_map);
break;
+
+ case 'F':
+ forever = 1;
+ follow_mode = Follow_name;
+ reopen_inaccessible_files =1;
case CHAR_MAX + 1:
reopen_inaccessible_files = 1;
Attachment:
pgpvrQ1LaFtxZ.pgp
Description: PGP signature