Cleaning wtmp

Cleaning wtmp

Post by Zarko » Tue, 24 Aug 1999 04:00:00



What is a good way to clean wtmp file. I know it can be cleaned
safely by using cron to just empty it but if I want to clean it during
the day while people are logged on, how would I purge out old stuff
but leave in the current info?
Any suggestions?
 
 
 

Cleaning wtmp

Post by Mike Moh » Wed, 25 Aug 1999 04:00:00



> What is a good way to clean wtmp file. I know it can be cleaned
> safely by using cron to just empty it but if I want to clean it during
> the day while people are logged on, how would I purge out old stuff
> but leave in the current info?
> Any suggestions?

There is a whole suite of software that handles this for you in
/usr/lib/acct.  Read the man pages on runacct.

================================================================

Information Technology Group      === Phone: 64 9 307-9999 x8133
Auckland Institute of Technology  === Fax:   64 9 307-9901
PO Box 92006, Auckland, New Zealand =
http://home.ait.ac.nz/staff/mmohr/
================================================================
If we have unlimited ability to think, why do we use computers?

 
 
 

Cleaning wtmp

Post by BIG » Wed, 25 Aug 1999 04:00:00


A possibility is to use ed editor to just leave a determined number of line
in the wtmp file.
You can use an hirescript in a cron like this exemple :

ed -s /var/adm/wtmp <<!
1,\$-500d
w
q
!

who open the wtmp file and delete all line between 1 and "end of file - x
line" (here 500). When you write (w), quit (q) and break hirescript (!)
So you have purged your file and leave the end who is corresponding of
currents informations.

bye

Zarkon a crit dans le message ...

Quote:>What is a good way to clean wtmp file. I know it can be cleaned
>safely by using cron to just empty it but if I want to clean it during
>the day while people are logged on, how would I purge out old stuff
>but leave in the current info?
>Any suggestions?

 
 
 

Cleaning wtmp

Post by Zarko » Wed, 25 Aug 1999 04:00:00


Thanks


>> What is a good way to clean wtmp file. I know it can be cleaned
>> safely by using cron to just empty it but if I want to clean it during
>> the day while people are logged on, how would I purge out old stuff
>> but leave in the current info?
>> Any suggestions?

>There is a whole suite of software that handles this for you in
>/usr/lib/acct.  Read the man pages on runacct.

>================================================================

>Information Technology Group      === Phone: 64 9 307-9999 x8133
>Auckland Institute of Technology  === Fax:   64 9 307-9901
>PO Box 92006, Auckland, New Zealand =
>http://home.ait.ac.nz/staff/mmohr/
>================================================================
>If we have unlimited ability to think, why do we use computers?

 
 
 

Cleaning wtmp

Post by Scott Farlin » Thu, 09 Sep 1999 04:00:00


this is how I do it:

cat - > wtmp
then hit:  ctrl d

scott


Quote:> What is a good way to clean wtmp file. I know it can be cleaned
> safely by using cron to just empty it but if I want to clean it during
> the day while people are logged on, how would I purge out old stuff
> but leave in the current info?
> Any suggestions?

 
 
 

Cleaning wtmp

Post by Bill Verza » Thu, 09 Sep 1999 04:00:00


or just ...

Quote:> wtmp

Bill.

> this is how I do it:

> cat - > wtmp
> then hit:  ctrl d

> scott



> > What is a good way to clean wtmp file. I know it can be cleaned
> > safely by using cron to just empty it but if I want to clean it during
> > the day while people are logged on, how would I purge out old stuff
> > but leave in the current info?
> > Any suggestions?

 
 
 

Cleaning wtmp

Post by David Stanaw » Fri, 10 Sep 1999 04:00:00



>or just ...

>> wtmp

>Bill.


>> this is how I do it:

>> cat - > wtmp
>> then hit:  ctrl d

I have missed the start of this thread..
But isn't it better to keep your wtmps around.

gunzip -c wtmp > wtmp`date +%Y%m%d`.gz && cat utmp > wtmp

This could loose someone logging out when you are gzipping the old log, but
it is at least a place to start.

===============================================================================
----------=| David Stanaway           |System Administrator         |=---------

===============================================================================

 
 
 

1. Cleaning wtmp

I want to implement a monthly script to truncate wtmp to keep its
size in line. I was thinking of a brute force method similar to
this:

cd /usr/adm
touch /etc/nologin
cp wtmp wtmp.old
cp /dev/null wtmp
rm /etc/nologin

However, although the /etc/nologin would prevent login updates to wtmp
while the two copies are made, it would not prevent logout updates.
Is there a recommended way to clean up wtmp on an active system?
--

Acadia Univ., Wolfville, NS, Canada B0P 1X0  902-542-2201  Fax: 902-542-4364

2. Precise time on SYSVR4

3. Utilities to clean up UTMP/WTMP?

4. Low level format

5. how do I clean out wtmp & wtmpx?

6. redundant network interface question

7. Do /var/adm/wtmp & wtmpx auto-clean?

8. /usr/pkg and /usr/local

9. WTMP clean

10. cleaning out wtmp

11. How to clean up lastlog, wtmp*, etc

12. Cleaning up WTMP on network logout

13. How to clean out wtmp