>Does anyone know exactly what utmpd is supposed to do? We are having the
>standard "screwed up entries in utmp/wtmp" problem. Does it periodically check
>utmp to make sure that bizarre entries are removed? I can't find any
>docmentation for utmpd.
dunno about utmpd.. but for 'screwed up entries in utmp' you
can give this program a shot.. i believe (although i am not
sure) that is was locally written by paul graham... there
wasn't an author's name in the code..
/*
* TITLE: cleanutmp
* SYNOPSIS: eliminate entries from /var/adm/utmp for dead processes
*/
#include <sys/types.h>
#include <utmp.h>
#include <errno.h>
#include <time.h>
extern int errno;
main(int argc, char **argv)
{
struct utmp *current;
char *ent_time;
while (current = getutent()) {
if (current->ut_type == USER_PROCESS
&& kill((pid_t) current->ut_pid, 0) == -1
&& errno == ESRCH) {
ent_time = asctime(localtime(¤t->ut_time));
printf("%-8.8s %-4.4s %-12.12s %5d %24.24s",
current->ut_user, current->ut_id,
current->ut_line, current->ut_pid,
ent_time);
current->ut_type = DEAD_PROCESS;
current->ut_exit.e_termination = ~0;
current->ut_exit.e_exit = ~0;
current->ut_time = time(0);
pututline(current);
printf(" marked DEAD\n");
}
}
Quote:}