> 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?
================================================================
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?
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?
>> 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?
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?
Bill.Quote:> wtmp
> 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?
>> wtmp
>Bill.
>> this is how I do it:
>> cat - > wtmp
>> then hit: ctrl d
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 |=---------
===========================================================================
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
3. Utilities to clean up UTMP/WTMP?
5. how do I clean out wtmp & wtmpx?
6. redundant network interface question
7. Do /var/adm/wtmp & wtmpx auto-clean?
9. WTMP clean
11. How to clean up lastlog, wtmp*, etc
12. Cleaning up WTMP on network logout