utmpd and utmp problems

utmpd and utmp problems

Post by Sean Ha » Sun, 09 Oct 1994 01:46:38



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.

Sean Harp

 
 
 

utmpd and utmp problems

Post by Jeff Murp » Mon, 10 Oct 1994 15:14:56



>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(&current->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:}


 
 
 

utmpd and utmp problems

Post by Matus Uhlar Softwa » Thu, 13 Oct 1994 18:00:09


-> 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.

yes.
--
Matus Uhlar,
Computer Centre of Technical University in Kosice, Slovakia