[comp.unix.wizards] Watchdog program

moore@ncsc.navy.mil (Moore) (11/27/89)

It seems like a program such as this should be very common:  does anyone have
a program (source, too, please!) to monitor terminal inactivity and shut down
any processes idle for a certain amount of time?  It would have to detect
processes that indicate Idle but really aren't (like a Kermit file transfer).

Target machine is an 11/750 running 4.3bsd (from Mt. Xinu).  Please forgive 
if this is a duplicate request, I may have already sent a query during the
panic phase of being assigned interim system administrator duties with no
experience....

Thanks for any assistance.

jim
moore@NCSC.navy.mil

jik@athena.mit.edu (Jonathan I. Kamens) (11/27/89)

In article <21529@adm.BRL.MIL> moore@ncsc.navy.mil (Moore) writes:
>It seems like a program such as this should be very common:  does anyone have
>a program (source, too, please!) to monitor terminal inactivity and shut down
>any processes idle for a certain amount of time?  It would have to detect
>processes that indicate Idle but really aren't (like a Kermit file transfer).

  The comp.sources.unix archives on uunet.uu.net (and, presumably,
whereever else they are archived) contains several such programs.  A
quick scan for "idle" in the c.s.u index reveals:

volume 3:
  idledaemon		Yet another idledaemon
volume 7:
  idle.users		A simple BSD idle-users daemon
  untamo2		Log out idle users
  untamo3		Log out idle users (untamo revised)

There may be others I've missed.

  You have to be careful when mentioning idle daemons on the net,
because for some reason some people feel very strongly that idle
daemons are a BAD idea, and will explain their opinions at length at
the least provocation.  This inevitably leads to a heated debate (read
"flame") which usually repeats to a tee the last debate on the same
subject.

  (Only 1/2 :-)

Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik@Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8495			      Home: 617-782-0710

RIC@rml2.sri.com (Ric Steinberger) (11/28/89)

You will find an autologout program on page 4 of the VAX Professional,
December 1987, (written in DCL so it's easy to understand), and another one
in the October 1986 issue of the same journal.  I'm sure you'll get
other responses.  These only run under VMS.  You might submit
your question to comp.unix.questions on usenix if you want a unix
version.  Actually, you could probably write a simple shell script
that used the w of finger command.  Both of these give idle time.
Finger lets you know what process is running, as well.  Good luck.

-ric steinberger

-------

mercer@ncrcce.StPaul.NCR.COM (Dan Mercer) (11/28/89)

In article <21529@adm.BRL.MIL> moore@ncsc.navy.mil (Moore) writes:
:
:It seems like a program such as this should be very common:  does anyone have
:a program (source, too, please!) to monitor terminal inactivity and shut down
:any processes idle for a certain amount of time?  It would have to detect
:processes that indicate Idle but really aren't (like a Kermit file transfer).
:
:Target machine is an 11/750 running 4.3bsd (from Mt. Xinu).  Please forgive 
:if this is a duplicate request, I may have already sent a query during the
:panic phase of being assigned interim system administrator duties with no
:experience....
:
:Thanks for any assistance.
:
:jim
:moore@NCSC.navy.mil

Be wary of any such program if all it does is check the access times
of the tty's (by doing a stat on /dev/ttyxx).  Many programs,  in
particular vi and kermit,  open the generic device /dev/tty.  The
times for the real device,  /dev/ttyxx,  are not updated.  I have
been stung by this on our news machine.  Chronically short of space,
yet because of the timeout limit,  you get knocked off doing large
transfers.

What you really need is a re-engineered ps to examine activity
times.



-- 

Dan Mercer
Reply-To: mercer@ncrcce.StPaul.NCR.COM (Dan Mercer)

brian@cosumn.edu (Brian Volkoff) (11/29/89)

In article <1755@ncrcce.StPaul.NCR.COM>, mercer@ncrcce.StPaul.NCR.COM (Dan Mercer) writes:
> times for the real device,  /dev/ttyxx,  are not updated.  I have
> been stung by this on our news machine.  Chronically short of space,
> yet because of the timeout limit,  you get knocked off doing large
> transfers.

Ditto.  I found the easiest solution to the above problem was to put a
short shell program in the background to "touch" my /dev/tty entry every
five minutes.  

dan@ccnysci.UUCP (Dan Schlitt) (12/09/89)

In article <107@cosumn.edu> brian@cosumn.edu (Brian Volkoff) writes:
>In article <1755@ncrcce.StPaul.NCR.COM>, mercer@ncrcce.StPaul.NCR.COM (Dan Mercer) writes:
>> times for the real device,  /dev/ttyxx,  are not updated.  I have
>> been stung by this on our news machine.  Chronically short of space,
>> yet because of the timeout limit,  you get knocked off doing large
>> transfers.

An annoying problem for several of our users when I ran such an
animal.

>Ditto.  I found the easiest solution to the above problem was to put a
>short shell program in the background to "touch" my /dev/tty entry every
>five minutes.  

And we see that users find counter-measures anyhow.

I inherited an idle daemon when I took over here.  After listening to
the debate on the net I decided to get rid of it.  I replaced it with
a hack to csh which times out if you sit at the prompt too long.  The
timeout interval is set by an environment variable and information
about it is in the on-line man page.  (I do run the old program 3
times a day to clean out cases where people really do forget to log
out -- 6pm, midnight, and 6am.)  The disaster of tens if not hundreds
of unused logged on terminals just never happened.  And no one comes
around and wants to know why the system logged them off in the middle
of editing a file.  I'm happy with the change.

-- 
Dan Schlitt                        Manager, Science Division Computer Facility
dan@sci.ccny.cuny.edu              City College of New York
dan@ccnysci.uucp                   New York, NY 10031
dan@ccnysci.bitnet                 (212)690-6868