Solaris wtmpx not updating
edit the /usr/lib/acct/runacct shell), and probably compress or gzip those copies.
That would preserve detailed connect-time info on a daily basis, while not confusing accounting.
One way or the other, I think Sun needs to provide some approach to keeping /var/adm/wtmpx consistent with /var/adm/wtmp while not letting it grow endlessly.
(hint) If it's good enough, they can use my code; no charge. If I understand what you're saying (my grasp of perl is best with the man page(s) in my lap, so I haven't read the code yet, but I will), that's probably a better approach for those who don't run accounting.
The principle is that those files * should be left in the same state whether or not accounting is run, so * that they reflect ongoing logins at the time they are cleaned out as * well as subsequent login/logout activity.
* --- cut here ---- (remove up to and including the "|" on the left, too) * |#!
Presumably if the same thing were done to /var/adm/wtmpx in such a way as to keep the timestamps in sync between /var/adm/wtmp and /var/adm/wtmpx, that would accomplish a suitable synchronized cleanup.
For those that don't run accounting, they could still zero out /var/adm/wtmp and /var/adm/wtmpx, and then run utmp2wtmp and whatever as yet nonexistent thing would do for /var/adm/wtmpx what utmp2wtmp does for /var/adm/wtmp.
So for those who are running accounting, a better bet would be to snarf copies of wtmp (and maybe wtmpx) before closewtmp (i.e.
Is there a way to clean /var/adm/wtmpx while keeping it in proper sync with /var/adm/wtmp?
/var/adm/wtmp gets cleaned nightly *if* one runs accounting, but apparently nothing cleans /var/adm/wtmpx.
new entries in /var/adm/wtmp between when the old version is copied and the new version is built could get lost, say a quick login/logout pair), I wonder whether I'm being pedantic to no practical end. ============================== Cut here ========================= /* with WTMPXSYNC enabled, /var/adm/wtmpx will be rebuilt from * /var/adm/utmpx the same way that /var/adm/wtmp is rebuilt from /var/adm/utmp * * If WTMPXSYNC is enabled and accounting is run, the following changes should * be made to /usr/lib/acct/runacct * --- cut here ---- (remove up to and including the "|" on the left, too) * |17a18 * | nulladm $ * --- cut here ---- * if accounting is not run, but cleaning out both /var/adm/wtmp and * /var/adm/wtmpx in a consistent fashion is desired, the following should * be put in a shell and put on cron to run regularly (say daily, weekly, or * monthly).
(I would still like to see accounting and utmp[x]/wtmp[x] handling in general tightened up a good deal.) Comments? One may also wish to save old files to serve as a record * _prior to_ running such a shell.
Search for solaris wtmpx not updating:
Until Sun deals with this issue, since I don't have source for utmp2wtmp, I'll have to either recreate its functionality and then add the additional functionality described above, or create the more complicated utmpx2wtmpx that would consult both /var/adm/utmpx and /var/adm/wtmp to achieve a consistent result (not forgetting to also add a line to the /usr/lib/acct/runacct shell script to zero out /var/adm/wtmpx prior to rebuilding it). It ran tonight, and looks like it did the job properly.