Operating System - HP-UX
1753621 Members
5715 Online
108797 Solutions
New Discussion юеВ

Re: File /var/adm/wtmp Cleanup

 
SOLVED
Go to solution
walztoni
Occasional Contributor

File /var/adm/wtmp Cleanup

The file /var/adm/wtmp is getting very large and filling up my /var FS. How should this file "wtmp" be administered?
Thank you,
Paul Walztoni
Moraine Valley Community College
8 REPLIES 8
Gordon  Morrison
Trusted Contributor

Re: File /var/adm/wtmp Cleanup

Hi Paul,
The easiest way is:
> wtmp
It's also the most efficient as far as reclaiming space goes, but a much safer way is fwtmp:
man fwtmp
should tell you what you need to know
What does this button do?
RAC_1
Honored Contributor
Solution

Re: File /var/adm/wtmp Cleanup

SAm log trimming. You can also do as follows.
Backup the file or compress.

> /var/adm/wtmp
cp /dev/null /var/adm/wtmp

Sometimes it gros because of following.
The /var/adm/wtmp file on the systems which do not have graphics console will
grow too and fill up the /var file system.
This is because, the X session tries to open the session on the graphic
console. And since it does not have a Graphics Console, it fails. All these
incidents are logged on to /var/adm/wtmp file.

To prevent this from happening.

1) Edit the file

/etc/dt/config/Xservers
and comment out the line which states

* Local local@console /usr/bin/X11/X :0
[ This is usually the last line in the file ].

2) Restart the cde server by
/usr/dt/bin/dtconfig -reset

Anil
There is no substitute to HARDWORK
James George_1
Trusted Contributor

Re: File /var/adm/wtmp Cleanup

Hi

You can also trim the logs in SAM.

SAM > Routine Taks > System Logs > select your log file > Action > trim > Trim to Zero ...

James
forum is for techies .....heaven is for those who are born again !!
HGN
Honored Contributor

Re: File /var/adm/wtmp Cleanup

Hi

To make a file null you can do
> filename or cat /dev/null >filename.

Rgds

HGN
A. Clay Stephenson
Acclaimed Contributor

Re: File /var/adm/wtmp Cleanup

The preferred way to do this is to use the fwtmp utility to read the file and produce a text file. You then purge this text file using sed, awk, or Perl and rewrite the wtmp file using the fwtmp utility again. Man 4 wtmp, fwtmp for details.
If it ain't broke, I can fix that.
Rajeev Tyagi
Valued Contributor

Re: File /var/adm/wtmp Cleanup

Paul,

You can use wtmpfix and fwtmp command as follows
cp /var/adm/wtmp > /tmp/wtmp
wtmpfix /tmp/wtmp | fwtmp | tail -200 | fwtmp -ic > /var/adm/wtmp

Here wtmpfix is fixing date and time stamps, fwtmp is converting from binary to ascii, Then we are taking last 200 lines and converting back to binary using ic flag.
walztoni
Occasional Contributor

Re: File /var/adm/wtmp Cleanup

Thank you all for your excellent replies, I've learned a lot this morning.
Everyone have a great weekend,
Paul Walztoni
Gordon  Morrison
Trusted Contributor

Re: File /var/adm/wtmp Cleanup

Don't forget to assign points!
It's snowing here, I need a bigger hat! :o)
What does this button do?