- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- clear 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
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
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
12-08-2003 06:15 AM
12-08-2003 06:15 AM
When I do a last|more it is quite huge, and this machine is not in production yet, so I would like to clear it out, and at least keep the first time the system was brought up.
Is there a file to change?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2003 06:16 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2003 06:19 AM
12-08-2003 06:19 AM
Re: clear the wtmp file
cat /dev/null > /var/adm/wtmp
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2003 06:24 AM
12-08-2003 06:24 AM
Re: clear the wtmp file
you also can do it with
cp /dev/null /var/adm/wtmp
greetings,
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2003 06:28 AM
12-08-2003 06:28 AM
Re: clear the wtmp file
cat /dev/null > /var/adm/wtmp
But do you have any issues with that? Is who reporting wrong details etc?
Then I would advise you to check wtmp patches.
Also have a look at fwtmp command. With command you can check wtmp file and fix it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2003 06:35 AM
12-08-2003 06:35 AM
Re: clear the wtmp file
# sam -> Routine Tasks ->
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2003 07:36 AM
12-08-2003 07:36 AM
Re: clear the wtmp file
- administration
- log files
Trim it to the selected amount.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2004 08:30 PM
05-27-2004 08:30 PM
Re: clear the wtmp file
--8<--- Script to reduce wtmp file to sensible size
#!/opt/perl/bin/perl
use strict;
use warnings;
use User::Utmp;
my ($n, $s, $treshold, @wtmp, %type) = (0, 0, time - 7 * 24 * 60 * 60); # One week should do
User::Utmp::utmpname (shift || "wtmp");
User::Utmp::setutent ();
while (my @entry = User::Utmp::getut1 ()) {
++$n % 100 or printf STDERR " %6d %6d\r", $n, $s;
if ( $entry[0]->{ut_type} == LOGIN_PROCESS &&
$entry[0]->{ut_time} > 0 && $entry[0]->{ut_time} < $treshold) {
$s++;
next;
}
push @wtmp, @entry;
}
User::Utmp::endutent ();
print STDERR "wtmp has $n entries, I skipped $s\n";
#print STDERR "[ ", (join ", ", map { "$_ => $type{$_}" } sort { $a <=> $b } keys %type), " ]\n";
User::Utmp::utmpname ("/tmp/wtmp");
User::Utmp::putut ($_) for @wtmp;
User::Utmp::endutent ();
-->8---
i2:/var/adm 126 # clrwtmp.pl
wtmp has 359424 entries, I skipped 358595
i2:/var/adm 127 # ll wtmp /tmp/wtmp
263 -rw-r--r-- 1 root system 1920 May 28 10:24 /tmp/wtmp
2074 -rw-r--r-- 1 root system 23003136 Jan 20 08:51 wtmp
i2:/var/adm 128 # mv /tmp/wtmp wtmp
All relevant info retained this way (boot time and such)
Enjoy, Have FUN! H.Merijn