- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Resizing the wtmp file
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-26-2003 04:57 AM
тАО06-26-2003 04:57 AM
I see my wtmp file has data over one year.( 33 Megs) Also btmp. My goal is to run a script that shows the last login of all the users to see if there are users that do not log in offen and deal with them. Since this just returns the month-daty I can not be sure if it is this year or last.
Is there a setting I can do to this file so it does not grow over x size?
Or knowing this is a binery file how do I resize it?
Marty
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-26-2003 04:59 AM
тАО06-26-2003 04:59 AM
Re: Resizing the wtmp file
SAM
Routine Task
System log files
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-26-2003 05:03 AM
тАО06-26-2003 05:03 AM
Re: Resizing the wtmp file
As far i know, SAM is not able to resize it, it will trim it (resize it to 0). The best to do that
is to use /usr/sbin/acct/fwtmp.
This command can convert your wtmp/btmp files to ascii, you can then modify it/resize it to some 20 last record, and then use the same command to convert it back to binary.
Take a look man fwtmp.
Cheers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-26-2003 05:06 AM
тАО06-26-2003 05:06 AM
SolutionWe use this cron entry:
00 01 1 * * /apps/bin/ts/wtmp_shrink 1>/dev/null 2>&1
and this script:
#!/bin/ksh
################################################################################
# wtmp_shrink - Reduce the size of /etc/wtmp. Currently run from
# /etc/rc, also left as executable in /usr/bin.
#
################################################################################
if [ -s /var/adm/wtmp ]
then
echo "Shrinking /var/adm/wtmp"
/usr/lib/acct/fwtmp < /var/adm/wtmp | tail -10 | /usr/lib/acct/fwtmp -ic > /
var/adm/wtmp
else
echo "\n\tWtmp file does not exist"
echo "\tCreating /var/adm/wtmp"
> /var/adm/wtmp
fi
to keep the size of the wtmp file in check.
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-26-2003 05:06 AM
тАО06-26-2003 05:06 AM
Re: Resizing the wtmp file
you can empty this file if not useful:
>wtmp
>btmp
Enrico.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-26-2003 05:08 AM
тАО06-26-2003 05:08 AM
Re: Resizing the wtmp file
Normally I nullify/empty the contents of the wtmp file in regular intervals (say once in 15 days). Write a cron job to do that. To empty the contents use this.
$cat /dev/null >wtmp
HTH,
Umapathy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-26-2003 05:08 AM
тАО06-26-2003 05:08 AM
Re: Resizing the wtmp file
Bruno is right. The exact procedure is :
# cat /var/adm/wtmp | /usr/sbin/acct/fwtmp > file
...
modify the file (using a script or vi)
...
# cat file | /usr/sbin/acct/fwtmp -ic > /var/adm/wtmp
Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-26-2003 05:11 AM
тАО06-26-2003 05:11 AM
Re: Resizing the wtmp file
I see in your script it is handling the binery stuff. Am I reading it right you are only saving 10 lines with the 'tail -10'?
I could just change that to whatwhat ever I need.
Marty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-26-2003 05:20 AM
тАО06-26-2003 05:20 AM
Re: Resizing the wtmp file
Thanks jean I like what you showed me because I can pull the information from the ASCII file.
Then reload the wtmp with the new data.
Thanks Pete because I can automate the process with yours.
Thanks the rest of you because you opened my eyes to other thoughts.
Marty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-26-2003 05:36 AM
тАО06-26-2003 05:36 AM
Re: Resizing the wtmp file
Another solution is to use a start/stop script in /sbin/init.d to take care of logfile trimming and archiving. Since most systems will need patches a couple of times during the year, the startup sequence can be used to archive the logs without problems due to users that are already logged in.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-26-2003 05:40 AM
тАО06-26-2003 05:40 AM
Re: Resizing the wtmp file
Yes - 10 lines - modify as needed.
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-26-2003 05:46 AM
тАО06-26-2003 05:46 AM
Re: Resizing the wtmp file
I found in the ASCII file that that it shows the year making it easy for me to look at the data with another script. being that it is only 500,000 lines long right now I think I will just use the ASCII copy and leave the wtmp binery file as is for now. After it is only 33MB and disc space is not a problem.
Thanks again,
Marty