Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

wtmpx file

Status
Not open for further replies.

crazyenglishman

IS-IT--Management
Jul 24, 2001
4
0
0
US
does anyone know, how to purge the wtmpx file

this file grow & grows and uses up disk space

thanks
 
delete it?
rm /var/adm/wtmpx ?

cat /dev/null > /var/adm/wtmpx

will leave a blank file with the same permissions and settings if you want but the wtmpx file will recreate itself happily.

Jon
 
Better still, try something like this (run it from cron every night/week, as necessary, & keep the number of generations appropriate to your site) :-

#!/bin/sh
# Rotate log files
cd /var/adm
for F in utmp utmpx wtmp wtmpx
do
if [ -f ${F}-5 ]; then rm -f ${F}-5
if [ -f ${F}-4 ]; then mv -f ${F}-4 ${F}-5
if [ -f ${F}-3 ]; then mv -f ${F}-3 ${F}-4
if [ -f ${F}-2 ]; then mv -f ${F}-2 ${F}-3
if [ -f ${F}-1 ]; then mv -f ${F}-1 ${F}-2
if [ -f ${F} ]; then mv -f ${F} ${F}-1
touch $F
done
============================================
This allows you to go back in time if there's any reason to investigate "strange goings on" ;-) Ayjaycee - the "A" in TandA

One by one, the penguins steal my sanity.
 
#
# Backup Procedure
#
#This deletes backups older than 25 days.
cd /var/adm
find . -name 'utmpx-*' -mtime +25 -exec rm {} \; -ls
#
#
FILEDATE=`date '+%m:%d:%Y:%H:%M:%S'`
compress utmpx > utmpx-${FILEDATE}.Z
cat /dev/null > utmpx

--
works better ... :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top