Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!epicb!dean From: dean@truevision.com (Dean Riddlebarger) Newsgroups: comp.unix.admin Subject: Re: Overflowing wtmp Summary: Let cron do it... Keywords: wtmp cron cleanup Message-ID: <1991Jan23.150231.608@truevision.com> Date: 23 Jan 91 15:02:31 GMT References: <92@tdatirv.UUCP> Organization: Truevision Inc., Indianapolis, IN Lines: 47 In article <92@tdatirv.UUCP> sarima@tdatirv.UUCP (Stanley Friesen) writes: > >I have found that my wtmp file tends to grow without bound. >This is annoying. Is there any clean way to trim it, short of the rather >crude 'cat /dev/null > /etc/wtmp' approach. (I *do* know about cron, >I just need to know what to put in it). Noting that your mileage may vary on a Xenix system, our ISC systems all have a cron script called /etc/cleanup, and this script contains a very simple line: > /etc/wtmp The script runs out of cron every Sunday, which means that wtmp only gets a week of growth max. Now, as to cron, the line entry in the root crontab for this cleanup script is: 17 5 * * 0 /bin/su root -c "/etc/cleanup > /dev/null" Meaning, "at 5:17 a.m. on every Sunday run the /etc/cleanup script as root, and send any output on stdout into the bit bucket". On ISC UNIX the easiest way to set up all of this [assuming that the /etc/cleanup script had not been shipped with the OS] would be: [1] cd /tmp [2] crontab -l >root /* creates a copy of the root crontab file */ [3] add a line like the "17 5 etc." above using your favorite editor [4] crontab root /* resets cron with the new root file */ [5] create /etc/cleanup, with the "> /etc/wtmp" line and whatever else you want to do for additional administration This assumes that you are root while you do this. [You have to be careful with cron, it seriously looks at your UID in this flavor of System V. And, for all I know, all flavors...] Hopefully, someone with more Xenix experience can provide a more detailed posting on the vagaries, if any, of Xenix cron facilities. -- <:> Dean Riddlebarger "The bus came by <:> <:> Truevision, Inc. and I got on, <:> <:> [317] 841-0332 That's when it <:> <:> dean@truevision.com uunet!epicb!dean all began." <:>