Re: Timeout for lazy users - Help Needed
Posted in 1998
On Fri, 11 Sep 1998 Rajesh_Kapur@spartanstores.com wrote:
> We are trying to implement some method that will log off users from the
> system after 2 hours of inactivity. [...] We have written a shell script
> that finds the PID from 'who -u', compares the inactive time and does a
> kill -1 on the PID, if old. This has worked well in our initial tests
> and has gracefully terminated user processes and the Informix threads as
> well. Our current environment(s) -->RS-6000, (AIX 3.2, Informix 5.05
> UC1) & (AIX 4.3, Informix 7.24 UC1).
>
> Questions:
>
> - Can 'kill -1' fail some of the time?
Yes. Also beware that some systems and some versions of I4GL have had
problems when being forcibly disconnected, such that the process goes into
a tight spin alternately getting a SIGHUP signal and doing an action to
clean up after it which generates another SIGHUP signal. I think that was
on a Pyramid a few years ago; it might affect other platforms too if you
are using older code. And it is not clear that the signal has to be a
SIGHUP to trigger the sequence (though after the first signal, it would be
SIGHUP that recurs).
> - Do we need to graduate to 'kill -6' or 'kill -9' if 'kill -1' fails?
Try SIGTERM (15), SIGPIPE (13), SIGALRM (14) and even SIGINT (2) or SIGQUIT
(3) before progressing to SIGIOT (aka SIGABRT) (6), let alone SIGKILL (9).
Never send SIGKILL to any server process (sqlexec, sqlturbo, oninit, ...)
until you've exhausted all other possibilities.
> - Can this kind of killing the user processes leave orphans behind?
In general, it shouldn't, but it might.
> - Does anyone have/know of some standard shell scripts etc. that will >
> gracefully exit the lazy users?
Not personally. Have you searched the IIUG archives (http://www.iiug.org)?
Yours,
Jonathan Leffler (jleffler@informix.com) #include <witticism.h>
Guardian of DBD::Informix v0.60 -- http://www.perl.com/CPAN
Informix IDN for D4GL & Linux -- http://www.informix.com/idn