Some of us have, literally for decades, been dealing with
wtmp by rolling it weekly or monthly or quarterly or whatever,
letting cron run something like
cd /usr/adm # that's how long I've been doing this!
umask 022
wtmp.new
ln wtmp wtmp.prev
mv wtmp.new wtmp
# also so long ago there was no seq(1)
nums=`awk 'BEGIN {for (i = 12; i >= 0; i--) print i; exit}'`
for i in $nums; do
inext=`expr $i + 1`
if [ -f wtmp.$i ]; then
mv wtmp.$i wtmp.$inext
fi
done
mv wtmp.prev wtmp.0
This really isn't rocket science. It isn't even particularly
interesting UNIX history. Can we move on to something that IS
interesting?
Here are some things I find more interesting:
1. utmp came before wtmp: utmp(V) appears in the First Edition
manual, wtmp(V) only in the Second. Apparently interest in
who else is logged in right now predated interest in who has
logged in recently.
2. Both files started out in /tmp. wtmp is first said to be
in /usr/adm instead in the Fifth Edition manual, utmp in /etc
in the Sixth.
3. The names /tmp/utmp and /tmp/wtmp appear to have been
issued by the Department of Redundancy Department. I think
it quite likely that Ken and Dennis would have been familiar
with that joke once the recording containing it was issued
in mid-1970, but I don't know whether utmp existed in some
form before that. I see no sign of it in the fragments of
PDP-7 source code we have (in particular init doesn't seem
to use it), but what about later PDP-7 or very early PDP-11
code predating the late-1971 First Edition manual?
Norman Wilson
Toronto ON
Not Insane