1849230 Members
7057 Online
104042 Solutions
New Discussion

hp-ux 10.20 wtmp & btmp

 
Sami Kankaanpaa
Occasional Contributor

hp-ux 10.20 wtmp & btmp

Hello!

I'd like to know, how to handle those two files. I have so huge wtmp file, that lastb -command is not working. Causes core if I try.
How to cut the size and then limit also?
samix
6 REPLIES 6
Animesh Chakraborty
Honored Contributor

Re: hp-ux 10.20 wtmp & btmp

hi,
#> wtmp
#>btmp


Regards
Animesh
Did you take a backup?
T G Manikandan
Honored Contributor

Re: hp-ux 10.20 wtmp & btmp

Hello,
do not use rm to remove the file.Make it null by
# cat /dev/null > /var/adm/wtmp
to make the file null.

to look into the contents and change the binary to ASCII.

# /usr/sbin/acct/fwtmp < /var/adm/wtmp > /tmp/wtmp

Again to change the file to binary
# /usr/sbin/acct/fwtmp -ic < /tmp/wtmp > /var/adm/wtmp

Thanks
G Manikandan

Robin Wakefield
Honored Contributor

Re: hp-ux 10.20 wtmp & btmp

Hi Sami,

You could trim your wtmp file using something like:

fwtmp < /var/adm/wtmp | tail -100 > /tmp/wtmp.new
fwtmp -ic < /tmp/wtmp.new > /var/adm/wtmp

or else zero it with:

cp /dev/null /var/adm/wtmp

Do not remove it, because it won't be created automatically.

Rgds, Robin.
Vincent Farrugia
Honored Contributor

Re: hp-ux 10.20 wtmp & btmp

Hello,

as correctly stated, use

> logfile

and not

rm logfile
touch logfile

since the permissions will be set incorrectly.

You can also do this using SAM. Go to Routine tasks, and System log files. From here you can zero or trim any logfile you want.

HTH,
Vince
Tape Drives RULE!!!
Animesh Chakraborty
Honored Contributor

Re: hp-ux 10.20 wtmp & btmp

Hi,
The command last(1) dumps core if the wtmp file is corrupted.

1. The wtmp file can be viewed with the following command:

# cat /var/adm/wtmp | /usr/sbin/acct/fwtmp | more

2. If the wtmp file is scrutinized as part of normal system
administrator procedures, consider using wtmpfix(1M) in an effort to
repair the file.

NOTE: See the man page wtmpfix(1M).

# /usr/sbin/acct/wtmpfix wtmp.old > wtmp.old.fix

3. Examine the contents of the new wtmp.old.fix.

# cat /var/adm/wtmp.old.fix | /usr/sbin/acct/fwtmp | more

4. If examining the file does not return an error, move the current wtmp to a
new name and replace it with the fixed version.

# mv /var/adm/wtmp /var/adm/wtmp.old
# mv /var/adm/wtmp.old.fix /var/adm/wtmp

5. If examining the file results in an error, clear the contents of wtmp:

# > /var/adm/wtmp

Regards
Animesh


Did you take a backup?
Sami Kankaanpaa
Occasional Contributor

Re: hp-ux 10.20 wtmp & btmp

Hello all,

thanks a lot, I did not succeed fix the wtmp file but instead managed to empty it. And now commands #last will works fine! And dir /var was almost full, thanks for help.
Regards, Sami
samix