Why is wtmp so big?
Aryeh M. Weiss
aryeh at eddie.mit.edu
Thu Dec 7 01:04:27 AEST 1989
In article <413 at tabbs.UUCP> aris at tabbs.UUCP (Aris Stathakis) writes:
> ...
>
>Is there perhaps any program out there ther truncates the /etc/wtmp
>file to the 100 most recent entries?
>
>Since it is a binary file, this is no trivial task.
^^^^^^
>
>Thanks in advance.
>
>Aris
>
>--
>Aris Stathakis | Bang: ..!uunet!ddsw1!olsa99!tabbs!aris or aris at tabbs.UUCP
> - Gimme a beer and money sandwich.... Hold the bread -
> - Waldo (D.R.) Dobbs
Since it IS a binary file, it IS a trivial task -- all records in the
file are the same size. I don't know the record size off hand, but you could
use something like "dd":
if file is big then
dd if=/etc/wtmp of=/tmp/wtmp bs=<record-size> \
skip=<(file-size/record-size) - 100> count=100
mv /tmp/wtmp /etc/wtmp
endif
Of course you need to know the record-size and file-size but these can be
figured out by suitable means.
--
eliot%lees-rif at eddie.mit.edu (Eliot H. Frank)
More information about the Comp.unix.xenix
mailing list