1833192 Members
2840 Online
110051 Solutions
New Discussion

Managing /var space

 
SOLVED
Go to solution
Indrajit_1
Valued Contributor

Managing /var space

Hi;

How do control /var/adm/wtmp file. it seems the file size is grown to 103444800. please help me.

cheers
indrajit
Never Ever Give Up
4 REPLIES 4
Jeff_Traigle
Honored Contributor

Re: Managing /var space

There's no mechanism in HP-UX to rotate /var/adm/wtmp or /var/adm/btmp. You can set up a cron job to rotate them periodically. Or use a tool like logrotate that you can get from the Porting Center to manage them and many other log files HP-UX doesn't manage out-of-the-box. A quick and dirty rotation:

cp -p /var/adm/wtmp /var/adm/wtmp.old
> /var/adm/wtmp
gzip /var/adm/wtmp.old
--
Jeff Traigle
James R. Ferguson
Acclaimed Contributor
Solution

Re: Managing /var space

Hi:

The file 'var/adm/wtmp' and its cousin '/var/adm/btmp' for logging successful and unsuccessful logins, respectively, grown without bounds.

If you don't want to log the activity, remove the file. That disables the logging.

Otherwise you can null the file:

# cat /dev/null > /var/adm/wtmp

...or trim it by first converting the binary data to ASCII; trimming what you don't want; and then converting the ASCII version back to the binary form:

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

[ trim the ASCII file as necessary ]

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

Regards!

...JRF...
Steven E. Protter
Exalted Contributor

Re: Managing /var space

Shalom indrajit,

Once a week, I have a script that does this:

cp /var/adm/syslog/wtmp /copytotape
cp /var/adm/syslog/btmp /copytotape

> /var/adm/syslog/wtmp
> /var/adm/syslog/btmp

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Indrajit_1
Valued Contributor

Re: Managing /var space

Hi All,

Thanks a lot for ur kind support. /var has reduced to 77%.

Thanks James R..


cheers
indrajit
Never Ever Give Up